Gitweb links:

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

The branch, vince/gtk-tab-restyle has been created
        at  5fecbca58bf6f3b62121e32677ab4a9ef096acb8 (commit)

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

    move toolbar to be in tab contents

diff --git a/frontends/gtk/res/netsurf.gtk2.ui 
b/frontends/gtk/res/netsurf.gtk2.ui
index 68812b3..431eab4 100644
--- a/frontends/gtk/res/netsurf.gtk2.ui
+++ b/frontends/gtk/res/netsurf.gtk2.ui
@@ -38,17 +38,6 @@
           </packing>
         </child>
         <child>
-          <object class="GtkToolbar" id="toolbar">
-            <property name="visible">True</property>
-            <property name="toolbar_style">GTK_TOOLBAR_BOTH_HORIZ</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
           <object class="GtkToolbar" id="searchbar">
             <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
             <child>
@@ -156,7 +145,7 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">False</property>
-            <property name="position">2</property>
+            <property name="position">1</property>
           </packing>
         </child>
         <child>
@@ -203,7 +192,7 @@
             </child>
           </object>
           <packing>
-            <property name="position">3</property>
+            <property name="position">2</property>
           </packing>
         </child>
       </object>
diff --git a/frontends/gtk/res/tabcontents.gtk2.ui 
b/frontends/gtk/res/tabcontents.gtk2.ui
index 63e290e..cbd7759 100644
--- a/frontends/gtk/res/tabcontents.gtk2.ui
+++ b/frontends/gtk/res/tabcontents.gtk2.ui
@@ -2,6 +2,131 @@
 <interface>
   <!-- interface-requires gtk+ 2.12 -->
   <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkVBox" id="tabBox">
+    <property name="visible">True</property>
+    <child>
+      <object class="GtkToolbar" id="toolbar">
+        <property name="visible">True</property>
+        <property name="toolbar_style">GTK_TOOLBAR_BOTH_HORIZ</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkToolbar" id="searchbar">
+        <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
+        <child>
+          <object class="GtkToolButton" id="closeSearchButton">
+            <property name="visible">True</property>
+            <property name="stock_id">gtk-close</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolItem" id="searchLabelItem">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkLabel" id="searchlabel">
+                <property name="visible">True</property>
+                <property name="xpad">4</property>
+                <property name="label" translatable="yes">Match</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolItem" id="toolSearch">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkEntry" id="searchEntry">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolButton" id="searchBackButton">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Search _Back</property>
+            <property name="use_underline">True</property>
+            <property name="stock_id">gtk-go-back</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolButton" id="searchForwardButton">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Search 
_Forward</property>
+            <property name="use_underline">True</property>
+            <property name="stock_id">gtk-go-forward</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolItem" id="checkAllSearchItem">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkCheckButton" id="checkAllSearch">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="tooltip-text" translatable="yes">show all 
matches</property>
+                <property name="label" translatable="yes">All      </property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolItem" id="caseSensItem">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkCheckButton" id="caseSensButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="tooltip-text" translatable="yes">Match case 
when searching</property>
+                <property name="label" translatable="yes">Case</property>
+                <property name="relief">GTK_RELIEF_NONE</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">False</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">2</property>
+      </packing>
+    </child>
+    <child>
       <object class="GtkTable" id="tabContents">
         <property name="visible">True</property>
         <property name="n_rows">2</property>
@@ -77,6 +202,11 @@
           </packing>
         </child>
       </object>
+      <packing>
+        <property name="position">3</property>
+      </packing>
+    </child>
+  </object>
   <object class="GtkAdjustment" id="layouthadjustment">
     <property name="upper">100</property>
     <property name="step_increment">30</property>
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index f142d10..f9eab82 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -124,9 +124,6 @@ struct nsgtk_scaffolding {
        /** In page text search context */
        struct gtk_search *search;
 
-       /** controls toolbar context */
-       struct nsgtk_toolbar *toolbar;
-
        /** menu bar hierarchy */
        struct nsgtk_bar_submenu *menu_bar;
 
@@ -2053,7 +2050,7 @@ nsgtk_search_create(GtkBuilder *builder, struct 
gtk_search **search_out)
 /* exported interface documented in gtk/scaffolding.h */
 void nsgtk_scaffolding_toolbars(struct nsgtk_scaffolding *g)
 {
-       nsgtk_toolbar_update(g->toolbar);
+  //   nsgtk_toolbar_update(g->toolbar);
        nsgtk_search_update(g->search);
 }
 
@@ -2573,11 +2570,6 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct 
gui_window *toplevel)
        gs->window = GTK_WINDOW(gtk_builder_get_object(gs->builder, 
"wndBrowser"));
        gs->notebook = GTK_NOTEBOOK(gtk_builder_get_object(gs->builder, 
"notebook"));
 
-       res = nsgtk_toolbar_create(gs->builder, &gs->toolbar);
-       if (res != NSERROR_OK) {
-               free(gs);
-               return NULL;
-       }
 
        res = nsgtk_search_create(gs->builder, &gs->search);
        if (res != NSERROR_OK) {
diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c
index 766ae41..de641f7 100644
--- a/frontends/gtk/window.c
+++ b/frontends/gtk/window.c
@@ -95,7 +95,10 @@ struct gui_window {
        /** previous event location */
        int last_x, last_y;
 
-       /** The top level container (tabContents) */
+       /** controls toolbar context */
+       struct nsgtk_toolbar *toolbar;
+
+       /** The top level container (tabBox) */
        GtkWidget *container;
 
        /** display widget for this page or frame */
@@ -501,7 +504,7 @@ static gboolean nsgtk_window_keypress_event(GtkWidget 
*widget,
 {
        struct gui_window *g = data;
        uint32_t nskey;
-       
+
        if (gtk_im_context_filter_keypress(g->input_method, event))
                return TRUE;
 
@@ -617,7 +620,7 @@ static gboolean nsgtk_window_keyrelease_event(GtkWidget 
*widget,
                                GdkEventKey *event, gpointer data)
 {
        struct gui_window *g = data;
-       
+
        return gtk_im_context_filter_keypress(g->input_method, event);
 }
 
@@ -767,12 +770,20 @@ gui_window_create(struct browser_window *bw,
        }
 
        /* Construct our primary elements */
-       g->container = GTK_WIDGET(gtk_builder_get_object(tab_builder, 
"tabContents"));
+       g->container = GTK_WIDGET(gtk_builder_get_object(tab_builder, 
"tabBox"));
        g->layout = GTK_LAYOUT(gtk_builder_get_object(tab_builder, "layout"));
        g->status_bar = GTK_LABEL(gtk_builder_get_object(tab_builder, 
"status_bar"));
        g->paned = GTK_PANED(gtk_builder_get_object(tab_builder, "hpaned1"));
        g->input_method = gtk_im_multicontext_new();
 
+
+       res = nsgtk_toolbar_create(tab_builder, &g->toolbar);
+       if (res != NSERROR_OK) {
+               free(g);
+               g_object_unref(tab_builder);
+               return NULL;
+       }
+
        /* set a default favicon */
        g_object_ref(favicon_pixbuf);
        g->icon = favicon_pixbuf;
@@ -863,6 +874,9 @@ gui_window_create(struct browser_window *bw,
        }
        nsgtk_tab_add(g, g->container, tempback, messages_get("NewTab"), 
g->icon);
 
+       /* \todo move search bar properly */
+       gtk_widget_hide(GTK_WIDGET(gtk_builder_get_object(tab_builder, 
"searchbar")));
+
        /* safe to drop the reference to the tab_builder as the container is
         * referenced by the notebook now.
         */
@@ -1288,7 +1302,7 @@ gui_window_file_gadget_open(struct gui_window *g,
                        NULL);
 
        NSLOG(netsurf, INFO, "*** open dialog: %p", dialog);
-                       
+
        int ret = gtk_dialog_run(GTK_DIALOG(dialog));
        NSLOG(netsurf, INFO, "*** return value: %d", ret);
        if (ret == GTK_RESPONSE_ACCEPT) {
@@ -1296,7 +1310,7 @@ gui_window_file_gadget_open(struct gui_window *g,
 
                filename = gtk_file_chooser_get_filename(
                        GTK_FILE_CHOOSER(dialog));
-               
+
                browser_window_set_gadget_filename(g->bw, gadget, filename);
 
                g_free(filename);


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

    get the code to at least compile again. toolbar is completely broken

diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index c739b3e..f142d10 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -312,12 +312,12 @@ scaffolding_window_delete_event(GtkWidget *widget,
 static void scaffolding_update_context(struct nsgtk_scaffolding *g)
 {
        struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
-
+#if 0
        g->buttons[BACK_BUTTON]->sensitivity =
-                       browser_window_history_back_available(bw);
-       g->buttons[FORWARD_BUTTON]->sensitivity =
-                       browser_window_history_forward_available(bw);
-
+                               browser_window_history_back_available(bw);
+               g->buttons[FORWARD_BUTTON]->sensitivity =
+                               browser_window_history_forward_available(bw);
+#endif
        nsgtk_scaffolding_set_sensitivity(g);
 
        /* update the url bar, particularly necessary when tabbing */
@@ -336,6 +336,7 @@ static void scaffolding_update_context(struct 
nsgtk_scaffolding *g)
  */
 static void nsgtk_throb(void *p)
 {
+#if 0
        nserror res;
        GdkPixbuf *pixbuf;
        struct nsgtk_scaffolding *g = p;
@@ -352,6 +353,7 @@ static void nsgtk_throb(void *p)
        }
 
        nsgtk_schedule(100, nsgtk_throb, p);
+#endif
 }
 
 
@@ -364,6 +366,7 @@ static guint
 nsgtk_scaffolding_update_edit_actions_sensitivity(
                struct nsgtk_scaffolding *g)
 {
+#if 0
        GtkWidget *widget = gtk_window_get_focus(g->window);
        gboolean has_selection;
 
@@ -392,6 +395,9 @@ nsgtk_scaffolding_update_edit_actions_sensitivity(
        return ((g->buttons[COPY_BUTTON]->sensitivity) |
                        (g->buttons[CUT_BUTTON]->sensitivity) |
                        (g->buttons[PASTE_BUTTON]->sensitivity));
+#else
+       return 0;
+#endif
 }
 
 
@@ -404,10 +410,11 @@ static void
 nsgtk_scaffolding_enable_edit_actions_sensitivity(
                struct nsgtk_scaffolding *g)
 {
-
+#if 0
        g->buttons[PASTE_BUTTON]->sensitivity = true;
        g->buttons[COPY_BUTTON]->sensitivity = true;
        g->buttons[CUT_BUTTON]->sensitivity = true;
+#endif
        nsgtk_scaffolding_set_sensitivity(g);
 
        popup_menu_show(g->menu_popup, false, false, true, false);
@@ -464,6 +471,7 @@ static gboolean nsgtk_window_popup_menu_hidden(GtkWidget 
*widget,
 /* exported interface documented in gtk/scaffolding.h */
 gboolean nsgtk_window_url_activate_event(GtkWidget *widget, gpointer data)
 {
+#if 0
        struct nsgtk_scaffolding *g = data;
        nserror ret;
        nsurl *url;
@@ -480,7 +488,7 @@ gboolean nsgtk_window_url_activate_event(GtkWidget *widget, 
gpointer data)
        if (ret != NSERROR_OK) {
                nsgtk_warning(messages_get_errorcode(ret), 0);
        }
-
+#endif
        return TRUE;
 }
 
@@ -550,9 +558,11 @@ nsgtk_window_tabs_add(GtkNotebook *notebook,
                     "visible", visible, NULL);
        g_object_set(g->menu_popup->view_submenu->tabs_menuitem,
                     "visible", visible, NULL);
+#if 0
        g->buttons[NEXTTAB_BUTTON]->sensitivity = visible;
        g->buttons[PREVTAB_BUTTON]->sensitivity = visible;
        g->buttons[CLOSETAB_BUTTON]->sensitivity = visible;
+#endif
        nsgtk_scaffolding_set_sensitivity(g);
 }
 
@@ -588,9 +598,11 @@ nsgtk_window_tabs_remove(GtkNotebook *notebook,
        gboolean visible = gtk_notebook_get_show_tabs(gs->notebook);
        g_object_set(gs->menu_bar->view_submenu->tabs_menuitem, "visible", 
visible, NULL);
        g_object_set(gs->menu_popup->view_submenu->tabs_menuitem, "visible", 
visible, NULL);
+#if 0
        gs->buttons[NEXTTAB_BUTTON]->sensitivity = visible;
        gs->buttons[PREVTAB_BUTTON]->sensitivity = visible;
        gs->buttons[CLOSETAB_BUTTON]->sensitivity = visible;
+#endif
        nsgtk_scaffolding_set_sensitivity(gs);
 }
 
@@ -1162,7 +1174,8 @@ MULTIHANDLER(cut)
 
        /* If the url bar has focus, let gtk handle it */
        if (GTK_IS_EDITABLE (focused))
-               gtk_editable_cut_clipboard (GTK_EDITABLE(g->url_bar));
+               //gtk_editable_cut_clipboard (GTK_EDITABLE(g->url_bar));
+               ;
        else
                browser_window_key_press(bw, NS_KEY_CUT_SELECTION);
 
@@ -1176,7 +1189,8 @@ MULTIHANDLER(copy)
 
        /* If the url bar has focus, let gtk handle it */
        if (GTK_IS_EDITABLE (focused))
-               gtk_editable_copy_clipboard(GTK_EDITABLE(g->url_bar));
+               //gtk_editable_copy_clipboard(GTK_EDITABLE(g->url_bar));
+               ;
        else
                browser_window_key_press(bw, NS_KEY_COPY_SELECTION);
 
@@ -1212,15 +1226,17 @@ MENUHANDLER(customize)
 MULTIHANDLER(selectall)
 {
        struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
-
+#if 0
        if (nsgtk_widget_has_focus(GTK_WIDGET(g->url_bar))) {
                NSLOG(netsurf, INFO, "Selecting all URL bar text");
                gtk_editable_select_region(GTK_EDITABLE(g->url_bar), 0, -1);
        } else {
+#endif
                NSLOG(netsurf, INFO, "Selecting all document text");
                browser_window_key_press(bw, NS_KEY_SELECT_ALL);
+#if 0
        }
-
+#endif
        return TRUE;
 }
 
@@ -1358,7 +1374,7 @@ MENUHANDLER(toolbar)
                                == FALSE)
                        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w),
                                        TRUE);
-               gtk_widget_show(GTK_WIDGET(g->tool_bar));
+               //gtk_widget_show(GTK_WIDGET(g->tool_bar));
        } else {
                w = 
GTK_WIDGET(g->menu_popup->view_submenu->toolbars_submenu->toolbar_menuitem);
                if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)))
@@ -1368,7 +1384,7 @@ MENUHANDLER(toolbar)
                if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)))
                        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w),
                                        FALSE);
-               gtk_widget_hide(GTK_WIDGET(g->tool_bar));
+               //gtk_widget_hide(GTK_WIDGET(g->tool_bar));
        }
 
        return TRUE;
@@ -1630,7 +1646,9 @@ MULTIHANDLER(showcookies)
 
 MULTIHANDLER(openlocation)
 {
+       #if 0
        gtk_widget_grab_focus(GTK_WIDGET(g->url_bar));
+       #endif
        return TRUE;
 }
 
@@ -1739,6 +1757,7 @@ BUTTONHANDLER(history)
 
 static void nsgtk_attach_menu_handlers(struct nsgtk_scaffolding *g)
 {
+       #if 0
        for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
                if (g->buttons[i]->main != NULL) {
                        g_signal_connect(g->buttons[i]->main, "activate",
@@ -1759,7 +1778,7 @@ static void nsgtk_attach_menu_handlers(struct 
nsgtk_scaffolding *g)
        CONNECT_CHECK(menubar);
        CONNECT_CHECK(toolbar);
 #undef CONNECT_CHECK
-
+#endif
 }
 
 /**
@@ -1845,7 +1864,7 @@ struct nsgtk_scaffolding *nsgtk_current_scaffolding(void)
        }
        return scaf_current;
 }
-
+#if 0
 /**
  * init the array g->buttons[]
  */
@@ -1937,6 +1956,7 @@ static void nsgtk_scaffolding_toolbar_init(struct 
nsgtk_scaffolding *g)
 
 }
 
+
 static void nsgtk_scaffolding_initial_sensitivity(struct nsgtk_scaffolding *g)
 {
        for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
@@ -1960,7 +1980,7 @@ static void nsgtk_scaffolding_initial_sensitivity(struct 
nsgtk_scaffolding *g)
        }
        
gtk_widget_set_sensitive(GTK_WIDGET(g->menu_bar->view_submenu->images_menuitem),
 FALSE);
 }
-
+#endif
 /**
  * update search toolbar size and style
  */
@@ -2023,7 +2043,7 @@ nsgtk_search_create(GtkBuilder *builder, struct 
gtk_search **search_out)
        search->caseSens = GTK_CHECK_BUTTON(gtk_builder_get_object(
                                                builder,"caseSensButton"));
 
-       nsgtk_search_update(search);    
+       nsgtk_search_update(search);
 
        *search_out = search;
        return NSERROR_OK;
@@ -2038,154 +2058,6 @@ void nsgtk_scaffolding_toolbars(struct 
nsgtk_scaffolding *g)
 }
 
 
-/* exported interface documented in gtk/scaffolding.h */
-struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
-{
-       nserror res;
-       struct nsgtk_scaffolding *gs;
-       int i;
-       GtkAccelGroup *group;
-
-       gs = calloc(1, sizeof(*gs));
-       if (gs == NULL) {
-               return NULL;
-       }
-
-       NSLOG(netsurf, INFO,
-             "Constructing a scaffold of %p for gui_window %p", gs, toplevel);
-
-       gs->top_level = toplevel;
-
-       /* Construct UI widgets */
-       if (nsgtk_builder_new_from_resname("netsurf", &gs->builder) != 
NSERROR_OK) {
-               free(gs);
-               return NULL;
-       }
-
-       gtk_builder_connect_signals(gs->builder, NULL);
-
-       gs->window = GTK_WINDOW(gtk_builder_get_object(builder, "wndBrowser"));
-       gs->notebook = GTK_NOTEBOOK(gtk_builder_get_object(builder, 
"notebook"));
-
-       res = nsgtk_toolbar_create(&gs->toolbar);
-       if (res != NSERROR_OK) {
-               free(gs);
-               return NULL;
-       }
-
-       res = nsgtk_search_create(&gs->search);
-       if (res != NSERROR_OK) {
-               free(gs);
-               return NULL;
-       }
-       
-       group = gtk_accel_group_new();
-       gtk_window_add_accel_group(gs->window, group);
-
-       gs->menu_bar = 
nsgtk_menu_bar_create(GTK_MENU_SHELL(gtk_builder_get_object(gs->builder, 
"menubar")), group);
-
-       /* set this window's size and position to what's in the options, or
-        * or some sensible default if they're not set yet.
-        */
-       if (nsoption_int(window_width) > 0) {
-               gtk_window_move(gs->window,
-                               nsoption_int(window_x),
-                               nsoption_int(window_y));
-               gtk_window_resize(gs->window,
-                                 nsoption_int(window_width),
-                                 nsoption_int(window_height));
-       } else {
-               /* Set to 1000x700, so we're very likely to fit even on
-                * 1024x768 displays, not being able to take into account
-                * window furniture or panels.
-                */
-               gtk_window_set_default_size(gs->window, 1000, 700);
-       }
-
-
-       nsgtk_tab_init(gs);
-
-
-
-
-       g_signal_connect_after(gs->notebook, "page-added",
-                       G_CALLBACK(nsgtk_window_tabs_add), gs);
-       g_signal_connect_after(gs->notebook, "page-removed",
-                       G_CALLBACK(nsgtk_window_tabs_remove), gs);
-
-#define CONNECT(obj, sig, callback, ptr) \
-       g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
-
-       /* connect main window signals to their handlers. */
-       CONNECT(gs->window, "delete-event",
-               scaffolding_window_delete_event, gs);
-
-       CONNECT(gs->window, "destroy", scaffolding_window_destroy, gs);
-
-       /* toolbar URL bar menu bar search bar signal handlers */
-       CONNECT(gs->menu_bar->edit_submenu->edit, "show",
-               nsgtk_window_edit_menu_shown, gs);
-       CONNECT(gs->menu_bar->edit_submenu->edit, "hide",
-               nsgtk_window_edit_menu_hidden, gs);
-
-       CONNECT(gs->search->buttons[1], "clicked",
-                       nsgtk_search_forward_button_clicked, gs);
-
-       CONNECT(gs->search->buttons[0], "clicked",
-                       nsgtk_search_back_button_clicked, gs);
-
-       CONNECT(gs->search->entry, "changed", nsgtk_search_entry_changed, gs);
-
-       CONNECT(gs->search->entry, "activate", nsgtk_search_entry_activate, gs);
-
-       CONNECT(gs->search->entry, "key-press-event",
-               nsgtk_search_entry_key, gs);
-
-       CONNECT(gs->search->buttons[2], "clicked",
-               nsgtk_search_close_button_clicked, gs);
-
-       CONNECT(gs->search->caseSens, "toggled",
-               nsgtk_search_entry_changed, gs);
-
-       /** \todo fix popup menu */
-       //CONNECT(gs->tool_bar, "popup-context-menu",
-       //      nsgtk_window_tool_bar_clicked, gs);
-
-       /* create popup menu */
-       gs->menu_popup = nsgtk_new_scaffolding_popup(gs, group);
-
-       gs->link_menu = nsgtk_new_scaffolding_link_popup(gs, group);
-
-       /* set up the menu signal handlers */
-       nsgtk_scaffolding_toolbar_init(gs);
-       nsgtk_toolbar_connect_all(gs);
-       nsgtk_attach_menu_handlers(gs);
-
-       nsgtk_scaffolding_initial_sensitivity(gs);
-
-       gs->fullscreen = false;
-
-       /* attach to the list */
-       if (scaf_list) {
-               scaf_list->prev = gs;
-       }
-       gs->next = scaf_list;
-       gs->prev = NULL;
-       scaf_list = gs;
-
-       /* set icon images */
-       nsgtk_theme_implement(gs);
-
-       /* set web search provider */
-       search_web_select_provider(nsoption_int(search_provider));
-
-       /* finally, show the window. */
-       gtk_widget_show(GTK_WIDGET(gs->window));
-
-       NSLOG(netsurf, INFO, "creation complete");
-
-       return gs;
-}
 
 /* exported function documented in gtk/scaffolding.h */
 void nsgtk_window_set_title(struct gui_window *gw, const char *title)
@@ -2234,19 +2106,21 @@ nserror gui_window_set_url(struct gui_window *gw, nsurl 
*url)
                        if (nsurl_get_utf8(url, &idn_url_s, &idn_url_l) != 
NSERROR_OK)
                                idn_url_s = NULL;
                }
-
+#if 0
                gtk_entry_set_text(GTK_ENTRY(g->url_bar), idn_url_s ? idn_url_s 
: nsurl_access(url));
+#endif
 
                if(idn_url_s)
                        free(idn_url_s);
 
-               gtk_editable_set_position(GTK_EDITABLE(g->url_bar), -1);
+               //gtk_editable_set_position(GTK_EDITABLE(g->url_bar), -1);
        }
        return NSERROR_OK;
 }
 
 void gui_window_start_throbber(struct gui_window* _g)
 {
+#if 0
        struct nsgtk_scaffolding *g = nsgtk_get_scaffold(_g);
        g->buttons[STOP_BUTTON]->sensitivity = true;
        g->buttons[RELOAD_BUTTON]->sensitivity = false;
@@ -2255,10 +2129,12 @@ void gui_window_start_throbber(struct gui_window* _g)
        scaffolding_update_context(g);
 
        nsgtk_schedule(100, nsgtk_throb, g);
+#endif
 }
 
 void gui_window_stop_throbber(struct gui_window* _g)
 {
+#if 0
        nserror res;
        GdkPixbuf *pixbuf;
        struct nsgtk_scaffolding *g = nsgtk_get_scaffold(_g);
@@ -2284,12 +2160,14 @@ void gui_window_stop_throbber(struct gui_window* _g)
            (g->throbber != NULL)) {
                gtk_image_set_from_pixbuf(g->throbber, pixbuf);
        }
+#endif
 }
 
 
 static void
 nsgtk_scaffolding_set_websearch(struct nsgtk_scaffolding *g, const char 
*content)
 {
+#if 0
        /** \todo this code appears technically correct, though
         * currently has no effect at all.
         */
@@ -2339,6 +2217,7 @@ nsgtk_scaffolding_set_websearch(struct nsgtk_scaffolding 
*g, const char *content
 */
        gtk_entry_set_visibility(GTK_ENTRY(g->webSearchEntry), TRUE);
        gtk_entry_set_text(GTK_ENTRY(g->webSearchEntry), content);
+#endif
 }
 
 /**
@@ -2372,7 +2251,7 @@ gui_search_web_provider_update(const char *provider_name,
        if (searchcontent != NULL) {
                sprintf(searchcontent, "Search %s", provider_name);
        }
-
+#if 0
        /* set the search provider parameters up in each scaffold */
        for (current = scaf_list; current != NULL; current = current->next) {
                if (current->webSearchEntry == NULL) {
@@ -2397,7 +2276,7 @@ gui_search_web_provider_update(const char *provider_name,
                        nsgtk_scaffolding_set_websearch(current, provider_name);
                }
        }
-
+#endif
        free(searchcontent);
 
        if (srch_pixbuf != NULL) {
@@ -2428,19 +2307,19 @@ GtkNotebook* nsgtk_scaffolding_notebook(struct 
nsgtk_scaffolding *g)
 /* exported interface documented in gtk/scaffolding.h */
 GtkWidget *nsgtk_scaffolding_urlbar(struct nsgtk_scaffolding *g)
 {
-       return g->url_bar;
+       return NULL;//g->url_bar;
 }
 
 /* exported interface documented in gtk/scaffolding.h */
 GtkWidget *nsgtk_scaffolding_websearch(struct nsgtk_scaffolding *g)
 {
-       return g->webSearchEntry;
+       return NULL;//g->webSearchEntry;
 }
 
 /* exported interface documented in gtk/scaffolding.h */
 GtkToolbar *nsgtk_scaffolding_toolbar(struct nsgtk_scaffolding *g)
 {
-       return g->tool_bar;
+       return NULL;//g->tool_bar;
 }
 
 /* exported interface documented in gtk/scaffolding.h */
@@ -2467,22 +2346,26 @@ struct nsgtk_scaffolding 
*nsgtk_scaffolding_iterate(struct nsgtk_scaffolding *g)
 /* exported interface documented in gtk/scaffolding.h */
 void nsgtk_scaffolding_reset_offset(struct nsgtk_scaffolding *g)
 {
-       g->offset = 0;
+       //g->offset = 0;
 }
 
 
 /* exported interface documented in gtk/scaffolding.h */
 void nsgtk_scaffolding_update_throbber_ref(struct nsgtk_scaffolding *g)
 {
+#if 0
        g->throbber = GTK_IMAGE(gtk_bin_get_child(
                        GTK_BIN(g->buttons[THROBBER_ITEM]->button)));
+#endif
 }
 
 /* exported interface documented in gtk/scaffolding.h */
 void nsgtk_scaffolding_update_websearch_ref(struct nsgtk_scaffolding *g)
 {
+#if 0
        g->webSearchEntry = gtk_bin_get_child(GTK_BIN(
                        g->buttons[WEBSEARCH_ITEM]->button));
+#endif
 }
 
 /* exported interface documented in gtk/scaffolding.h */
@@ -2541,6 +2424,7 @@ void nsgtk_scaffolding_set_top_level(struct gui_window 
*gw)
 /* exported interface documented in scaffolding.h */
 void nsgtk_scaffolding_set_sensitivity(struct nsgtk_scaffolding *g)
 {
+#if 0
        int i;
 #define SENSITIVITY(q)\
                i = q##_BUTTON;\
@@ -2573,6 +2457,7 @@ void nsgtk_scaffolding_set_sensitivity(struct 
nsgtk_scaffolding *g)
        SENSITIVITY(PREVTAB)
        SENSITIVITY(CLOSETAB)
 #undef SENSITIVITY
+#endif
 }
 
 
@@ -2596,7 +2481,7 @@ void nsgtk_scaffolding_context_menu(struct 
nsgtk_scaffolding *g,
                gtkmenu = g->menu_popup->popup_menu;
 
                nsgtk_scaffolding_update_edit_actions_sensitivity(g);
-
+#if 0
                if (!(g->buttons[COPY_BUTTON]->sensitivity)) {
                        
gtk_widget_hide(GTK_WIDGET(g->menu_popup->copy_menuitem));
                } else {
@@ -2614,7 +2499,7 @@ void nsgtk_scaffolding_context_menu(struct 
nsgtk_scaffolding *g,
                } else {
                        
gtk_widget_show(GTK_WIDGET(g->menu_popup->paste_menuitem));
                }
-
+#endif
                /* hide customise */
                popup_menu_hide(g->menu_popup, false, false, false, true);
        }
@@ -2629,6 +2514,7 @@ void nsgtk_scaffolding_context_menu(struct 
nsgtk_scaffolding *g,
 void nsgtk_scaffolding_toolbar_size_allocate(GtkWidget *widget,
                GtkAllocation *alloc, gpointer data)
 {
+       #if 0
        struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
        int i = nsgtk_toolbar_get_id_from_widget(widget, g);
        if (i == -1)
@@ -2654,4 +2540,152 @@ void nsgtk_scaffolding_toolbar_size_allocate(GtkWidget 
*widget,
        }
        g->toolbarmem = alloc->x;
        gtk_widget_size_allocate(widget, alloc);
+       #endif
+}
+
+
+/* exported interface documented in gtk/scaffolding.h */
+struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
+{
+       nserror res;
+       struct nsgtk_scaffolding *gs;
+       int i;
+       GtkAccelGroup *group;
+
+       gs = calloc(1, sizeof(*gs));
+       if (gs == NULL) {
+               return NULL;
+       }
+
+       NSLOG(netsurf, INFO,
+             "Constructing a scaffold of %p for gui_window %p", gs, toplevel);
+
+       gs->top_level = toplevel;
+
+       /* Construct UI widgets */
+       if (nsgtk_builder_new_from_resname("netsurf", &gs->builder) != 
NSERROR_OK) {
+               free(gs);
+               return NULL;
+       }
+
+       gtk_builder_connect_signals(gs->builder, NULL);
+
+       gs->window = GTK_WINDOW(gtk_builder_get_object(gs->builder, 
"wndBrowser"));
+       gs->notebook = GTK_NOTEBOOK(gtk_builder_get_object(gs->builder, 
"notebook"));
+
+       res = nsgtk_toolbar_create(gs->builder, &gs->toolbar);
+       if (res != NSERROR_OK) {
+               free(gs);
+               return NULL;
+       }
+
+       res = nsgtk_search_create(gs->builder, &gs->search);
+       if (res != NSERROR_OK) {
+               free(gs);
+               return NULL;
+       }
+
+       group = gtk_accel_group_new();
+       gtk_window_add_accel_group(gs->window, group);
+
+       gs->menu_bar = 
nsgtk_menu_bar_create(GTK_MENU_SHELL(gtk_builder_get_object(gs->builder, 
"menubar")), group);
+
+       /* set this window's size and position to what's in the options, or
+        * or some sensible default if they're not set yet.
+        */
+       if (nsoption_int(window_width) > 0) {
+               gtk_window_move(gs->window,
+                               nsoption_int(window_x),
+                               nsoption_int(window_y));
+               gtk_window_resize(gs->window,
+                                 nsoption_int(window_width),
+                                 nsoption_int(window_height));
+       } else {
+               /* Set to 1000x700, so we're very likely to fit even on
+                * 1024x768 displays, not being able to take into account
+                * window furniture or panels.
+                */
+               gtk_window_set_default_size(gs->window, 1000, 700);
+       }
+
+
+       nsgtk_tab_init(gs);
+
+       g_signal_connect_after(gs->notebook, "page-added",
+                       G_CALLBACK(nsgtk_window_tabs_add), gs);
+       g_signal_connect_after(gs->notebook, "page-removed",
+                       G_CALLBACK(nsgtk_window_tabs_remove), gs);
+
+#define CONNECT(obj, sig, callback, ptr) \
+       g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
+
+       /* connect main window signals to their handlers. */
+       CONNECT(gs->window, "delete-event",
+               scaffolding_window_delete_event, gs);
+
+       CONNECT(gs->window, "destroy", scaffolding_window_destroy, gs);
+
+       /* toolbar URL bar menu bar search bar signal handlers */
+       CONNECT(gs->menu_bar->edit_submenu->edit, "show",
+               nsgtk_window_edit_menu_shown, gs);
+       CONNECT(gs->menu_bar->edit_submenu->edit, "hide",
+               nsgtk_window_edit_menu_hidden, gs);
+
+       CONNECT(gs->search->buttons[1], "clicked",
+                       nsgtk_search_forward_button_clicked, gs);
+
+       CONNECT(gs->search->buttons[0], "clicked",
+                       nsgtk_search_back_button_clicked, gs);
+
+       CONNECT(gs->search->entry, "changed", nsgtk_search_entry_changed, gs);
+
+       CONNECT(gs->search->entry, "activate", nsgtk_search_entry_activate, gs);
+
+       CONNECT(gs->search->entry, "key-press-event",
+               nsgtk_search_entry_key, gs);
+
+       CONNECT(gs->search->buttons[2], "clicked",
+               nsgtk_search_close_button_clicked, gs);
+
+       CONNECT(gs->search->caseSens, "toggled",
+               nsgtk_search_entry_changed, gs);
+
+       /** \todo fix popup menu */
+       //CONNECT(gs->tool_bar, "popup-context-menu",
+       //      nsgtk_window_tool_bar_clicked, gs);
+
+       /* create popup menu */
+       gs->menu_popup = nsgtk_new_scaffolding_popup(gs, group);
+
+       gs->link_menu = nsgtk_new_scaffolding_link_popup(gs, group);
+
+       /* set up the menu signal handlers */
+       //nsgtk_scaffolding_toolbar_init(gs);
+       //nsgtk_toolbar_connect_all(gs);
+       nsgtk_attach_menu_handlers(gs);
+
+       //nsgtk_scaffolding_initial_sensitivity(gs);
+
+       gs->fullscreen = false;
+
+       /* attach to the list */
+       if (scaf_list) {
+               scaf_list->prev = gs;
+       }
+       gs->next = scaf_list;
+       gs->prev = NULL;
+       scaf_list = gs;
+
+       /* set icon images */
+       nsgtk_theme_implement(gs);
+
+       /* set web search provider */
+       search_web_select_provider(nsoption_int(search_provider));
+
+       /* finally, show the window. */
+       gtk_widget_show(GTK_WIDGET(gs->window));
+
+       NSLOG(netsurf, INFO, "creation complete");
+
+       return gs;
 }
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 02b1e66..724e373 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -188,490 +188,6 @@ nsgtk_toolbar_##name##_data_minus(GtkWidget *widget,      
                \
 
 
 /**
- * Apply the user toolbar button settings from configuration
- *
- * GTK specific user option string is a set of fields arranged as
- * [itemreference];[itemlocation]|[itemreference];[itemlocation]| etc
- *
- * \param tb The toolbar to apply customization to
- * \param NSERROR_OK on success else error code.
- */
-static nserror
-apply_user_button_customization(struct nsgtk_toolbar *tb)
-{
-       int i, ii;
-       char *buffer;
-       char *buffer1, *subbuffer, *ptr = NULL, *pter = NULL;
-
-       /* set all button locations to inactive */
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               tb->buttons[i]->location = INACTIVE_LOCATION;
-       }
-
-       /* if no user config is present apply the defaults */
-       if (nsoption_charp(toolbar_order) == NULL) {
-               tb->buttons[BACK_BUTTON]->location = 0;
-               tb->buttons[HISTORY_BUTTON]->location = 1;
-               tb->buttons[FORWARD_BUTTON]->location = 2;
-               tb->buttons[STOP_BUTTON]->location = 3;
-               tb->buttons[RELOAD_BUTTON]->location = 4;
-               tb->buttons[URL_BAR_ITEM]->location = 5;
-               tb->buttons[WEBSEARCH_ITEM]->location = 6;
-               tb->buttons[THROBBER_ITEM]->location = 7;
-
-               return NSERROR_OK;
-       }
-
-       buffer = strdup(nsoption_charp(toolbar_order));
-       if (buffer == NULL) {
-               return NSERROR_NOMEM;
-       }
-
-       i = BACK_BUTTON;
-       ii = BACK_BUTTON;
-       buffer1 = strtok_r(buffer, "|", &ptr);
-       while (buffer1 != NULL) {
-               subbuffer = strtok_r(buffer1, ";", &pter);
-               if (subbuffer != NULL) {
-                       i = atoi(subbuffer);
-                       subbuffer = strtok_r(NULL, ";", &pter);
-                       if (subbuffer != NULL) {
-                               ii = atoi(subbuffer);
-                               if ((i >= BACK_BUTTON) &&
-                                   (i < PLACEHOLDER_BUTTON) &&
-                                   (ii >= -1) &&
-                                   (ii < PLACEHOLDER_BUTTON)) {
-                                       tb->buttons[i]->location = ii;
-                               }
-                       }
-               }
-               buffer1 = strtok_r(NULL, "|", &ptr);
-       }
-
-       free(buffer);
-       return NSERROR_OK;
-}
-
-
-/**
- * widget factory for creation of toolbar item widgets
- *
- * \param i the id of the widget
- * \param theme the theme to make the widgets from
- * \return gtk widget
- */
-static GtkWidget *
-make_toolbar_item(nsgtk_toolbar_button i, struct nsgtk_theme *theme)
-{
-       GtkWidget *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_WIDGET(gtk_tool_button_new(GTK_WIDGET(  \
-                                          theme->image[p##_BUTTON]), label)); \
-                       free(label);                                    \
-               } else {                                                \
-                       w = GTK_WIDGET(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
-
-       case HISTORY_BUTTON:
-               w = GTK_WIDGET(gtk_tool_button_new(GTK_WIDGET(
-                               theme->image[HISTORY_BUTTON]), "H"));
-               break;
-
-       case URL_BAR_ITEM: {
-               GtkWidget *entry = nsgtk_entry_new();
-               w = GTK_WIDGET(gtk_tool_item_new());
-
-               if ((entry == NULL) || (w == NULL)) {
-                       nsgtk_warning(messages_get("NoMemory"), 0);
-                       return NULL;
-               }
-
-               gtk_container_add(GTK_CONTAINER(w), entry);
-               gtk_tool_item_set_expand(GTK_TOOL_ITEM(w), TRUE);
-               break;
-       }
-
-       case THROBBER_ITEM: {
-               nserror res;
-               GdkPixbuf *pixbuf;
-               res = nsgtk_throbber_get_frame(0, &pixbuf);
-               if (res != NSERROR_OK) {
-                       return NULL;
-               }
-
-               if (edit_mode) {
-                       w = GTK_WIDGET(gtk_tool_button_new(
-                               GTK_WIDGET(gtk_image_new_from_pixbuf(pixbuf)),
-                               "[throbber]"));
-               } else {
-                       GtkWidget *image;
-
-                       w = GTK_WIDGET(gtk_tool_item_new());
-
-                       image = gtk_image_new_from_pixbuf(pixbuf);
-                       if (image != NULL) {
-                               nsgtk_widget_set_alignment(image,
-                                                          GTK_ALIGN_CENTER,
-                                                          GTK_ALIGN_CENTER);
-                               nsgtk_widget_set_margins(image, 3, 0);
-
-                               gtk_container_add(GTK_CONTAINER(w), image);
-                       }
-               }
-               break;
-       }
-
-       case WEBSEARCH_ITEM: {
-               if (edit_mode)
-                       return GTK_WIDGET(gtk_tool_button_new(GTK_WIDGET(
-                                       
nsgtk_image_new_from_stock(NSGTK_STOCK_FIND,
-                                       GTK_ICON_SIZE_LARGE_TOOLBAR)),
-                                       "[websearch]"));
-
-               GtkWidget *entry = nsgtk_entry_new();
-
-               w = GTK_WIDGET(gtk_tool_item_new());
-
-               if ((entry == NULL) || (w == NULL)) {
-                       nsgtk_warning(messages_get("NoMemory"), 0);
-                       return NULL;
-               }
-
-               gtk_widget_set_size_request(entry, NSGTK_WEBSEARCH_WIDTH, -1);
-
-               nsgtk_entry_set_icon_from_stock(entry, GTK_ENTRY_ICON_PRIMARY,
-                                               NSGTK_STOCK_INFO);
-
-               gtk_container_add(GTK_CONTAINER(w), entry);
-               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_WIDGET(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)
-#undef MAKE_MENUBUTTON
-
-       default:
-               break;
-
-       }
-       return w;
-}
-
-
-/**
- * append item to gtk toolbar container
- *
- * \param tb toolbar
- * \param theme in use
- * \param location item location being appended
- * \return NSERROR_OK on success else error code.
- */
-static nserror
-append_item_to_toolbar(struct nsgtk_toolbar *tb,
-                      struct nsgtk_theme *theme,
-                      int location)
-{
-       int bidx; /* button index */
-
-       for (bidx = BACK_BUTTON; bidx < PLACEHOLDER_BUTTON; bidx++) {
-
-               if (tb->buttons[bidx]->location == location) {
-
-                       tb->buttons[bidx]->button = GTK_TOOL_ITEM(
-                                       make_toolbar_item(bidx, theme));
-
-                       gtk_toolbar_insert(tb->widget,
-                                          tb->buttons[bidx]->button,
-                                          location);
-                       break;
-               }
-       }
-       return NSERROR_OK;
-}
-
-
-/**
- * callback function to remove a widget from a container
- */
-static void container_remove_widget(GtkWidget *widget, gpointer data)
-{
-       GtkContainer *container = GTK_CONTAINER(data);
-       gtk_container_remove(container, widget);
-}
-
-
-/**
- * populates the gtk toolbar container with widgets in correct order
- */
-static nserror populate_gtk_toolbar_widget(struct nsgtk_toolbar *tb)
-{
-       struct nsgtk_theme *theme; /* internal theme context */
-       int lidx; /* location index */
-
-       theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, false);
-       if (theme == NULL) {
-               return NSERROR_NOMEM;
-       }
-
-       /* clear the toolbar container of all widgets */
-       gtk_container_foreach(GTK_CONTAINER(tb->widget),
-                             container_remove_widget,
-                             tb->widget);
-
-       /* add widgets to toolbar */
-       for (lidx = 0; lidx < PLACEHOLDER_BUTTON; lidx++) {
-               add_item_to_toolbar(tb, theme, lidx);
-       }
-
-       gtk_widget_show_all(GTK_WIDGET(tb->widget));
-       free(theme);
-
-       return NSERROR_OK;
-}
-
-/**
- * create a toolbar item
- *
- * create a toolbar item and set up its default handlers
- */
-static nserror
-toolbar_item_create(nsgtk_toolbar_button id,
-                   struct nsgtk_toolbar_item **item_out)
-{
-       struct nsgtk_toolbar_item *item;
-       item = calloc(1, sizeof(struct nsgtk_toolbar_item));
-       if (item == NULL) {
-               return NSERROR_NOMEM;
-       }
-       item->location = INACTIVE_LOCATION;
-                       
-       switch (id) {
-#define TOOLBAR_ITEM(identifier, name, snstvty)                                
\
-       case identifier:                                                \
-               item->sensitivity = snstvty;                            \
-               item->dataplus = nsgtk_toolbar_##name##_data_plus;      \
-               item->dataminus = nsgtk_toolbar_##name##_data_minus;    \
-               break;
-#include "gtk/toolbar_items.h"
-#undef TOOLBAR_ITEM
-       }
-
-        *item_out = item;
-        return NSERROR_OK;
-}
-
-/* exported interface documented in toolbar.h */
-nserror nsgtk_toolbar_create(GtkBuilder *builder, struct nsgtk_toolbar 
**tb_out)
-{
-       nserror res;
-       struct nsgtk_toolbar *tb;
-       int bidx; /* button index */
-
-       tb = calloc(1, sizeof(struct nsgtk_toolbar));
-       if (tb == NULL) {
-               return NSERROR_NOMEM;
-       }
-
-       tb->widget = GTK_TOOLBAR(gtk_builder_get_object(builder, "toolbar"));
-
-       /* allocate button contexts */
-       for (bidx = BACK_BUTTON; bidx < PLACEHOLDER_BUTTON; bidx++) {
-               res = toolbar_item_create(bidx, &tb->buttons[bidx]);
-               if (res != NSERROR_OK) {
-                       for (bidx-- ; bidx >= BACK_BUTTON; bidx--) {
-                               free(tb->buttons[bidx]);
-                       }
-                       free(tb);
-                       return res;
-               }
-       }
-
-       res = apply_user_button_customization(tb);
-       if (res != NSERROR_OK) {
-               free(tb);
-               return res;
-       }
-
-       res = populate_gtk_toolbar_widget(tb);
-       if (res != NSERROR_OK) {
-               free(tb);
-               return res;
-       }
-
-       res = nsgtk_toolbar_update(tb);
-       if (res != NSERROR_OK) {
-               free(tb);
-               return res;
-       }
-
-       gtk_toolbar_set_show_arrow(tb->widget, TRUE);
-       gtk_widget_show_all(GTK_WIDGET(tb->widget));
-
-       /* if there is a history widget set its size */
-       if (tb->buttons[HISTORY_BUTTON]->button != NULL) {
-               gtk_widget_set_size_request(GTK_WIDGET(
-                       tb->buttons[HISTORY_BUTTON]->button), 20, -1);
-       }
-
-       /* set up the throbber. */
-       tb->throb_frame = 0;
-
-       /* set up URL bar completion */
-       tb->url_bar_completion = nsgtk_url_entry_completion_new(gs);
-       
-       *tb_out = tb;
-       return NSERROR_OK;
-}
-
-
-/* exported interface documented in toolbar.h */
-nserror nsgtk_toolbar_destroy(struct nsgtk_toolbar *tb)
-{
-       /** \todo free buttons and destroy toolbar container (and widgets) */
-       free(tb);
-       return NSERROR_OK;
-}
-
-/* exported interface documented in toolbar.h */
-nserror nsgtk_toolbar_update(struct nsgtk_toolbar *tb)
-{
-       switch (nsoption_int(button_type)) {
-
-       case 1: /* Small icons */
-               gtk_toolbar_set_style(GTK_TOOLBAR(tb->widget),
-                                     GTK_TOOLBAR_ICONS);
-               gtk_toolbar_set_icon_size(GTK_TOOLBAR(tb->widget),
-                                         GTK_ICON_SIZE_SMALL_TOOLBAR);
-               break;
-
-       case 2: /* Large icons */
-               gtk_toolbar_set_style(GTK_TOOLBAR(g->tool_bar),
-                                     GTK_TOOLBAR_ICONS);
-               gtk_toolbar_set_icon_size(GTK_TOOLBAR(g->tool_bar),
-                                         GTK_ICON_SIZE_LARGE_TOOLBAR);
-               break;
-
-       case 3: /* Large icons with text */
-               gtk_toolbar_set_style(GTK_TOOLBAR(g->tool_bar),
-                                     GTK_TOOLBAR_BOTH);
-               gtk_toolbar_set_icon_size(GTK_TOOLBAR(g->tool_bar),
-                                         GTK_ICON_SIZE_LARGE_TOOLBAR);
-               break;
-
-       case 4: /* Text icons only */
-               gtk_toolbar_set_style(GTK_TOOLBAR(g->tool_bar),
-                                     GTK_TOOLBAR_TEXT);
-               break;
-
-       default:
-               break;
-       }
-
-       return NSERROR_OK;
-}
-
-
-/**
- * returns a string without its underscores
- *
- * \param s The string to change.
- * \param replacespace true to insert a space where there was an underscore
- * \return The altered string
- */
-static char *remove_underscores(const char *s, bool replacespace)
-{
-       size_t i, ii, len;
-       char *ret;
-       len = strlen(s);
-       ret = malloc(len + 1);
-       if (ret == NULL) {
-               return NULL;
-       }
-       for (i = 0, ii = 0; i < len; i++) {
-               if (s[i] != '_') {
-                       ret[ii++] = s[i];
-               } else if (replacespace) {
-                       ret[ii++] = ' ';
-               }
-       }
-       ret[ii] = '\0';
-       return ret;
-}
-
-
-/**
  * get default image for buttons / menu items from gtk stock items.
  *
  * \param tbbutton button reference
@@ -820,7 +336,11 @@ static struct nsgtk_theme *nsgtk_theme_load(GtkIconSize 
iconsize, bool usedef)
        return theme;
 }
 
-
+static struct nsgtk_toolbar_item *
+nsgtk_scaffolding_button(struct nsgtk_scaffolding *g, int i)
+{
+       return NULL;
+}
 
 /* exported function documented in gtk/toolbar.h */
 void nsgtk_theme_implement(struct nsgtk_scaffolding *g)
@@ -939,33 +459,239 @@ static void nsgtk_toolbar_temp_connect(struct 
nsgtk_scaffolding *g,
 {
        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);
-               }
-       }
-}
+       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);
+               }
+       }
+}
+
+/**
+ * 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
+ *
+ * \param s The string to change.
+ * \param replacespace true to insert a space where there was an underscore
+ * \return The altered string
+ */
+static char *remove_underscores(const char *s, bool replacespace)
+{
+       size_t i, ii, len;
+       char *ret;
+       len = strlen(s);
+       ret = malloc(len + 1);
+       if (ret == NULL) {
+               return NULL;
+       }
+       for (i = 0, ii = 0; i < len; i++) {
+               if (s[i] != '_') {
+                       ret[ii++] = s[i];
+               } else if (replacespace) {
+                       ret[ii++] = ' ';
+               }
+       }
+       ret[ii] = '\0';
+       return ret;
+}
+
+
+/**
+ * widget factory for creation of toolbar item widgets
+ *
+ * \param i the id of the widget
+ * \param theme the theme to make the widgets from
+ * \return gtk widget
+ */
+static GtkWidget *
+make_toolbar_item(nsgtk_toolbar_button i, struct nsgtk_theme *theme)
+{
+       GtkWidget *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_WIDGET(gtk_tool_button_new(GTK_WIDGET(  \
+                                          theme->image[p##_BUTTON]), label)); \
+                       free(label);                                    \
+               } else {                                                \
+                       w = GTK_WIDGET(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
+
+       case HISTORY_BUTTON:
+               w = GTK_WIDGET(gtk_tool_button_new(GTK_WIDGET(
+                               theme->image[HISTORY_BUTTON]), "H"));
+               break;
+
+       case URL_BAR_ITEM: {
+               GtkWidget *entry = nsgtk_entry_new();
+               w = GTK_WIDGET(gtk_tool_item_new());
+
+               if ((entry == NULL) || (w == NULL)) {
+                       nsgtk_warning(messages_get("NoMemory"), 0);
+                       return NULL;
+               }
+
+               gtk_container_add(GTK_CONTAINER(w), entry);
+               gtk_tool_item_set_expand(GTK_TOOL_ITEM(w), TRUE);
+               break;
+       }
+
+       case THROBBER_ITEM: {
+               nserror res;
+               GdkPixbuf *pixbuf;
+
+               res = nsgtk_throbber_get_frame(0, &pixbuf);
+               if (res != NSERROR_OK) {
+                       return NULL;
+               }
+
+               if (edit_mode) {
+                       w = GTK_WIDGET(gtk_tool_button_new(
+                               GTK_WIDGET(gtk_image_new_from_pixbuf(pixbuf)),
+                               "[throbber]"));
+               } else {
+                       GtkWidget *image;
+
+                       w = GTK_WIDGET(gtk_tool_item_new());
+
+                       image = gtk_image_new_from_pixbuf(pixbuf);
+                       if (image != NULL) {
+                               nsgtk_widget_set_alignment(image,
+                                                          GTK_ALIGN_CENTER,
+                                                          GTK_ALIGN_CENTER);
+                               nsgtk_widget_set_margins(image, 3, 0);
+
+                               gtk_container_add(GTK_CONTAINER(w), image);
+                       }
+               }
+               break;
+       }
+
+       case WEBSEARCH_ITEM: {
+               if (edit_mode)
+                       return GTK_WIDGET(gtk_tool_button_new(GTK_WIDGET(
+                                       
nsgtk_image_new_from_stock(NSGTK_STOCK_FIND,
+                                       GTK_ICON_SIZE_LARGE_TOOLBAR)),
+                                       "[websearch]"));
+
+               GtkWidget *entry = nsgtk_entry_new();
+
+               w = GTK_WIDGET(gtk_tool_item_new());
+
+               if ((entry == NULL) || (w == NULL)) {
+                       nsgtk_warning(messages_get("NoMemory"), 0);
+                       return NULL;
+               }
+
+               gtk_widget_set_size_request(entry, NSGTK_WEBSEARCH_WIDTH, -1);
+
+               nsgtk_entry_set_icon_from_stock(entry, GTK_ENTRY_ICON_PRIMARY,
+                                               NSGTK_STOCK_INFO);
+
+               gtk_container_add(GTK_CONTAINER(w), entry);
+               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_WIDGET(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)
+#undef MAKE_MENUBUTTON
+
+       default:
+               break;
 
-/**
- * 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;
+       return w;
 }
 
 
@@ -1190,6 +916,33 @@ static void nsgtk_toolbar_close(struct nsgtk_scaffolding 
*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
  */
@@ -1596,144 +1349,404 @@ void nsgtk_toolbar_customization_init(struct 
nsgtk_scaffolding *g)
                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);
+       /* 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);
+}
+
+
+/**
+ * \return toolbar item id when a widget is an element of the scaffolding
+ * else -1
+ */
+int nsgtk_toolbar_get_id_from_widget(GtkWidget *widget,
+                                    struct nsgtk_scaffolding *g)
+{
+       int i;
+       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
+               if ((nsgtk_scaffolding_button(g, i)->location != -1)
+                               && (widget == GTK_WIDGET(
+                               nsgtk_scaffolding_button(g, i)->button))) {
+                       return i;
+               }
+       }
+       return -1;
+}
+
+/* exported interface documented in gtk/scaffolding.h */
+static void nsgtk_scaffolding_update_url_bar_ref(struct nsgtk_scaffolding *g)
+{
+       #if 0
+       g->url_bar = GTK_WIDGET(gtk_bin_get_child(GTK_BIN(
+                       g->buttons[URL_BAR_ITEM]->button)));
+
+       gtk_entry_set_completion(GTK_ENTRY(g->url_bar),
+                       g->url_bar_completion);
+       #endif
+}
+
+/**
+ * add handlers to factory widgets
+ * \param g the scaffolding to attach handlers to
+ * \param i the toolbar item id
+ */
+static void
+nsgtk_toolbar_set_handler(struct nsgtk_scaffolding *g, nsgtk_toolbar_button i)
+{
+       switch(i){
+       case URL_BAR_ITEM:
+               nsgtk_scaffolding_update_url_bar_ref(g);
+               g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_urlbar(g)),
+                                "activate", G_CALLBACK(
+                                        nsgtk_window_url_activate_event), g);
+               g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_urlbar(g)),
+                                "changed", G_CALLBACK(
+                                        nsgtk_window_url_changed), g);
+               break;
+
+       case THROBBER_ITEM:
+               nsgtk_scaffolding_update_throbber_ref(g);
+               break;
+
+       case WEBSEARCH_ITEM:
+               nsgtk_scaffolding_update_websearch_ref(g);
+               g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_websearch(g)),
+                                "activate", G_CALLBACK(
+                                        nsgtk_websearch_activate), g);
+               g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_websearch(g)),
+                                "button-press-event", G_CALLBACK(
+                                        nsgtk_websearch_clear), g);
+               break;
+
+       default:
+               if ((nsgtk_scaffolding_button(g, i)->bhandler != NULL) &&
+                   (nsgtk_scaffolding_button(g, i)->button != NULL)) {
+                       g_signal_connect(
+                               nsgtk_scaffolding_button(g, i)->button,
+                               "clicked",
+                               G_CALLBACK(nsgtk_scaffolding_button(
+                                                  g, i)->bhandler), g);
+               }
+               break;
+       }
+}
+
+/**
+ * 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;
+               if (nsgtk_scaffolding_button(g, q)->button != NULL)
+                       g_signal_connect(
+                                       nsgtk_scaffolding_button(g, q)->button,
+                                       "size-allocate", G_CALLBACK(
+                                       nsgtk_scaffolding_toolbar_size_allocate
+                                       ), g);
+               nsgtk_toolbar_set_handler(g, q);
+       }
+}
+
+
+/**
+ * Apply the user toolbar button settings from configuration
+ *
+ * GTK specific user option string is a set of fields arranged as
+ * [itemreference];[itemlocation]|[itemreference];[itemlocation]| etc
+ *
+ * \param tb The toolbar to apply customization to
+ * \param NSERROR_OK on success else error code.
+ */
+static nserror
+apply_user_button_customization(struct nsgtk_toolbar *tb)
+{
+       int i, ii;
+       char *buffer;
+       char *buffer1, *subbuffer, *ptr = NULL, *pter = NULL;
+
+       /* set all button locations to inactive */
+       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
+               tb->buttons[i]->location = INACTIVE_LOCATION;
+       }
+
+       /* if no user config is present apply the defaults */
+       if (nsoption_charp(toolbar_order) == NULL) {
+               tb->buttons[BACK_BUTTON]->location = 0;
+               tb->buttons[HISTORY_BUTTON]->location = 1;
+               tb->buttons[FORWARD_BUTTON]->location = 2;
+               tb->buttons[STOP_BUTTON]->location = 3;
+               tb->buttons[RELOAD_BUTTON]->location = 4;
+               tb->buttons[URL_BAR_ITEM]->location = 5;
+               tb->buttons[WEBSEARCH_ITEM]->location = 6;
+               tb->buttons[THROBBER_ITEM]->location = 7;
+
+               return NSERROR_OK;
+       }
+
+       buffer = strdup(nsoption_charp(toolbar_order));
+       if (buffer == NULL) {
+               return NSERROR_NOMEM;
+       }
+
+       i = BACK_BUTTON;
+       ii = BACK_BUTTON;
+       buffer1 = strtok_r(buffer, "|", &ptr);
+       while (buffer1 != NULL) {
+               subbuffer = strtok_r(buffer1, ";", &pter);
+               if (subbuffer != NULL) {
+                       i = atoi(subbuffer);
+                       subbuffer = strtok_r(NULL, ";", &pter);
+                       if (subbuffer != NULL) {
+                               ii = atoi(subbuffer);
+                               if ((i >= BACK_BUTTON) &&
+                                   (i < PLACEHOLDER_BUTTON) &&
+                                   (ii >= -1) &&
+                                   (ii < PLACEHOLDER_BUTTON)) {
+                                       tb->buttons[i]->location = ii;
+                               }
+                       }
+               }
+               buffer1 = strtok_r(NULL, "|", &ptr);
+       }
+
+       free(buffer);
+       return NSERROR_OK;
+}
+
+
+/**
+ * append item to gtk toolbar container
+ *
+ * \param tb toolbar
+ * \param theme in use
+ * \param location item location being appended
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+add_item_to_toolbar(struct nsgtk_toolbar *tb,
+                      struct nsgtk_theme *theme,
+                      int location)
+{
+       int bidx; /* button index */
+
+       for (bidx = BACK_BUTTON; bidx < PLACEHOLDER_BUTTON; bidx++) {
+
+               if (tb->buttons[bidx]->location == location) {
+
+                       tb->buttons[bidx]->button = GTK_TOOL_ITEM(
+                                       make_toolbar_item(bidx, theme));
 
-       /* 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);
+                       gtk_toolbar_insert(tb->widget,
+                                          tb->buttons[bidx]->button,
+                                          location);
+                       break;
+               }
+       }
+       return NSERROR_OK;
+}
 
-       /* open toolbar window */
-       nsgtk_toolbar_window_open(g);
+
+/**
+ * callback function to remove a widget from a container
+ */
+static void container_remove_widget(GtkWidget *widget, gpointer data)
+{
+       GtkContainer *container = GTK_CONTAINER(data);
+       gtk_container_remove(container, widget);
 }
 
+
 /**
- * set toolbar logical -> physical; physically visible toolbar buttons are made
- * to correspond to the logically stored schema in terms of location
- * visibility etc
+ * populates the gtk toolbar container with widgets in correct order
  */
-void nsgtk_toolbar_set_physical(struct nsgtk_scaffolding *g)
+static nserror populate_gtk_toolbar_widget(struct nsgtk_toolbar *tb)
 {
-       int i;
-       struct nsgtk_theme *theme;
+       struct nsgtk_theme *theme; /* internal theme context */
+       int lidx; /* location index */
 
        theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, false);
        if (theme == NULL) {
-               nsgtk_warning(messages_get("NoMemory"), 0);
-               return;
+               return NSERROR_NOMEM;
        }
-       /* 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);
+
+       /* clear the toolbar container of all widgets */
+       gtk_container_foreach(GTK_CONTAINER(tb->widget),
+                             container_remove_widget,
+                             tb->widget);
+
+       /* add widgets to toolbar */
+       for (lidx = 0; lidx < PLACEHOLDER_BUTTON; lidx++) {
+               add_item_to_toolbar(tb, theme, lidx);
        }
-       gtk_widget_show_all(GTK_WIDGET(nsgtk_scaffolding_toolbar(g)));
+
+       gtk_widget_show_all(GTK_WIDGET(tb->widget));
        free(theme);
+
+       return NSERROR_OK;
 }
 
 /**
- * \return toolbar item id when a widget is an element of the scaffolding
- * else -1
+ * create a toolbar item
+ *
+ * create a toolbar item and set up its default handlers
  */
-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)
 {
-       int i;
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               if ((nsgtk_scaffolding_button(g, i)->location != -1)
-                               && (widget == GTK_WIDGET(
-                               nsgtk_scaffolding_button(g, i)->button))) {
-                       return i;
-               }
+       struct nsgtk_toolbar_item *item;
+       item = calloc(1, sizeof(struct nsgtk_toolbar_item));
+       if (item == NULL) {
+               return NSERROR_NOMEM;
        }
-       return -1;
+       item->location = INACTIVE_LOCATION;
+
+       switch (id) {
+#define TOOLBAR_ITEM(identifier, name, snstvty)                                
\
+       case identifier:                                                \
+               item->sensitivity = snstvty;                            \
+               item->dataplus = nsgtk_toolbar_##name##_data_plus;      \
+               item->dataminus = nsgtk_toolbar_##name##_data_minus;    \
+               break;
+#include "gtk/toolbar_items.h"
+#undef TOOLBAR_ITEM
+
+       case PLACEHOLDER_BUTTON:
+               free(item);
+               return NSERROR_INVALID;
+       }
+
+       *item_out = item;
+       return NSERROR_OK;
 }
 
-/* exported interface documented in gtk/scaffolding.h */
-void nsgtk_scaffolding_update_url_bar_ref(struct nsgtk_scaffolding *g)
+/* exported interface documented in toolbar.h */
+nserror nsgtk_toolbar_create(GtkBuilder *builder, struct nsgtk_toolbar 
**tb_out)
 {
-       g->url_bar = GTK_WIDGET(gtk_bin_get_child(GTK_BIN(
-                       g->buttons[URL_BAR_ITEM]->button)));
+       nserror res;
+       struct nsgtk_toolbar *tb;
+       int bidx; /* button index */
 
-       gtk_entry_set_completion(GTK_ENTRY(g->url_bar),
-                       g->url_bar_completion);
+       tb = calloc(1, sizeof(struct nsgtk_toolbar));
+       if (tb == NULL) {
+               return NSERROR_NOMEM;
+       }
+
+       tb->widget = GTK_TOOLBAR(gtk_builder_get_object(builder, "toolbar"));
+
+       /* allocate button contexts */
+       for (bidx = BACK_BUTTON; bidx < PLACEHOLDER_BUTTON; bidx++) {
+               res = toolbar_item_create(bidx, &tb->buttons[bidx]);
+               if (res != NSERROR_OK) {
+                       for (bidx-- ; bidx >= BACK_BUTTON; bidx--) {
+                               free(tb->buttons[bidx]);
+                       }
+                       free(tb);
+                       return res;
+               }
+       }
+
+       res = apply_user_button_customization(tb);
+       if (res != NSERROR_OK) {
+               free(tb);
+               return res;
+       }
+
+       res = populate_gtk_toolbar_widget(tb);
+       if (res != NSERROR_OK) {
+               free(tb);
+               return res;
+       }
+
+       res = nsgtk_toolbar_update(tb);
+       if (res != NSERROR_OK) {
+               free(tb);
+               return res;
+       }
+
+       gtk_toolbar_set_show_arrow(tb->widget, TRUE);
+       gtk_widget_show_all(GTK_WIDGET(tb->widget));
+
+       /* if there is a history widget set its size */
+       if (tb->buttons[HISTORY_BUTTON]->button != NULL) {
+               gtk_widget_set_size_request(GTK_WIDGET(
+                       tb->buttons[HISTORY_BUTTON]->button), 20, -1);
+       }
+
+       /* set up the throbber. */
+       tb->throb_frame = 0;
+
+       /* set up URL bar completion */
+       /** \todo sort out completion */
+       //tb->url_bar_completion = nsgtk_url_entry_completion_new(gs);
+
+       *tb_out = tb;
+       return NSERROR_OK;
 }
 
-/**
- * add handlers to factory widgets
- * \param g the scaffolding to attach handlers to
- * \param i the toolbar item id
- */
-static void
-nsgtk_toolbar_set_handler(struct nsgtk_scaffolding *g, nsgtk_toolbar_button i)
+
+/* exported interface documented in toolbar.h */
+nserror nsgtk_toolbar_destroy(struct nsgtk_toolbar *tb)
 {
-       switch(i){
-       case URL_BAR_ITEM:
-               nsgtk_scaffolding_update_url_bar_ref(g);
-               g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_urlbar(g)),
-                                "activate", G_CALLBACK(
-                                        nsgtk_window_url_activate_event), g);
-               g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_urlbar(g)),
-                                "changed", G_CALLBACK(
-                                        nsgtk_window_url_changed), g);
+       /** \todo free buttons and destroy toolbar container (and widgets) */
+       free(tb);
+       return NSERROR_OK;
+}
+
+/* exported interface documented in toolbar.h */
+nserror nsgtk_toolbar_update(struct nsgtk_toolbar *tb)
+{
+       switch (nsoption_int(button_type)) {
+
+       case 1: /* Small icons */
+               gtk_toolbar_set_style(GTK_TOOLBAR(tb->widget),
+                                     GTK_TOOLBAR_ICONS);
+               gtk_toolbar_set_icon_size(GTK_TOOLBAR(tb->widget),
+                                         GTK_ICON_SIZE_SMALL_TOOLBAR);
                break;
 
-       case THROBBER_ITEM:
-               nsgtk_scaffolding_update_throbber_ref(g);
+       case 2: /* Large icons */
+               gtk_toolbar_set_style(GTK_TOOLBAR(tb->widget),
+                                     GTK_TOOLBAR_ICONS);
+               gtk_toolbar_set_icon_size(GTK_TOOLBAR(tb->widget),
+                                         GTK_ICON_SIZE_LARGE_TOOLBAR);
                break;
 
-       case WEBSEARCH_ITEM:
-               nsgtk_scaffolding_update_websearch_ref(g);
-               g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_websearch(g)),
-                                "activate", G_CALLBACK(
-                                        nsgtk_websearch_activate), g);
-               g_signal_connect(GTK_WIDGET(nsgtk_scaffolding_websearch(g)),
-                                "button-press-event", G_CALLBACK(
-                                        nsgtk_websearch_clear), g);
+       case 3: /* Large icons with text */
+               gtk_toolbar_set_style(GTK_TOOLBAR(tb->widget),
+                                     GTK_TOOLBAR_BOTH);
+               gtk_toolbar_set_icon_size(GTK_TOOLBAR(tb->widget),
+                                         GTK_ICON_SIZE_LARGE_TOOLBAR);
+               break;
+
+       case 4: /* Text icons only */
+               gtk_toolbar_set_style(GTK_TOOLBAR(tb->widget),
+                                     GTK_TOOLBAR_TEXT);
                break;
 
        default:
-               if ((nsgtk_scaffolding_button(g, i)->bhandler != NULL) &&
-                   (nsgtk_scaffolding_button(g, i)->button != NULL)) {
-                       g_signal_connect(
-                               nsgtk_scaffolding_button(g, i)->button,
-                               "clicked",
-                               G_CALLBACK(nsgtk_scaffolding_button(
-                                                  g, i)->bhandler), g);
-               }
                break;
        }
-}
 
-/**
- * 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;
-               if (nsgtk_scaffolding_button(g, q)->button != NULL)
-                       g_signal_connect(
-                                       nsgtk_scaffolding_button(g, q)->button,
-                                       "size-allocate", G_CALLBACK(
-                                       nsgtk_scaffolding_toolbar_size_allocate
-                                       ), g);
-               nsgtk_toolbar_set_handler(g, q);
-       }
+       return NSERROR_OK;
 }
-
-
diff --git a/frontends/gtk/toolbar_items.h b/frontends/gtk/toolbar_items.h
index fd01103..0e1eae4 100644
--- a/frontends/gtk/toolbar_items.h
+++ b/frontends/gtk/toolbar_items.h
@@ -83,6 +83,11 @@ typedef enum {
  *   item initial visibility
  */
 
+#ifndef TOOLBAR_ITEM
+#define TOOLBAR_ITEM(a, b, c)
+#define TOOLBAR_ITEM_SET
+#endif
+
 TOOLBAR_ITEM(BACK_BUTTON, back, false)
 TOOLBAR_ITEM(HISTORY_BUTTON, history, true)
 TOOLBAR_ITEM(FORWARD_BUTTON, forward, false)
@@ -134,3 +139,8 @@ TOOLBAR_ITEM(CONTENTS_BUTTON, contents, true)
 TOOLBAR_ITEM(GUIDE_BUTTON, guide, true)
 TOOLBAR_ITEM(INFO_BUTTON, info, true)
 TOOLBAR_ITEM(ABOUT_BUTTON, about, true)
+
+#ifdef TOOLBAR_ITEM_SET
+#undef TOOLBAR_ITEM
+#undef TOOLBAR_ITEM_SET
+#endif


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

    moved most of init to toolbar.c

diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index f0bee4e..7f33315 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -159,12 +159,15 @@ nsgtk_init_resource_path(const char *config_home)
 /**
  * Set option defaults for gtk frontend.
  *
- * @param defaults The option table to update.
- * @return error status.
+ * \param defaults The option table to update.
+ * \return error status.
  */
 static nserror set_defaults(struct nsoption_s *defaults)
 {
        char *fname;
+       GtkSettings *settings;
+       GtkIconSize tooliconsize;
+       GtkToolbarStyle toolbarstyle;
 
        /* cookie file default */
        fname = NULL;
@@ -217,6 +220,35 @@ static nserror set_defaults(struct nsoption_s *defaults)
        nsoption_set_charp(font_cursive, strdup("Serif"));
        nsoption_set_charp(font_fantasy, strdup("Serif"));
 
+       /* Default toolbar button type to system defaults */
+
+       settings = gtk_settings_get_default();
+       g_object_get(settings,
+                    "gtk-toolbar-icon-size", &tooliconsize,
+                    "gtk-toolbar-style", &toolbarstyle, NULL);
+
+       switch (toolbarstyle) {
+       case GTK_TOOLBAR_ICONS:
+               if (tooliconsize == GTK_ICON_SIZE_SMALL_TOOLBAR) {
+                       nsoption_set_int(button_type, 1);
+               } else {
+                       nsoption_set_int(button_type, 2);
+               }
+               break;
+
+       case GTK_TOOLBAR_TEXT:
+               nsoption_set_int(button_type, 4);
+               break;
+
+       case GTK_TOOLBAR_BOTH:
+       case GTK_TOOLBAR_BOTH_HORIZ:
+               /* no labels in default configuration */
+       default:
+               /* No system default, so use large icons */
+               nsoption_set_int(button_type, 2);
+               break;
+       }
+       
        return NSERROR_OK;
 }
 
diff --git a/frontends/gtk/preferences.c b/frontends/gtk/preferences.c
index dac4a55..652075c 100644
--- a/frontends/gtk/preferences.c
+++ b/frontends/gtk/preferences.c
@@ -799,7 +799,7 @@ nsgtk_preferences_comboButtonType_changed(GtkComboBox 
*widget,
        while (current != NULL) {
                nsgtk_scaffolding_reset_offset(current);
 
-               nsgtk_scaffolding_toolbars(current, nsoption_int(button_type));
+               nsgtk_scaffolding_toolbars(current);
 
                current = nsgtk_scaffolding_iterate(current);
        }
diff --git a/frontends/gtk/res/tabcontents.gtk3.ui 
b/frontends/gtk/res/tabcontents.gtk3.ui
index 23328b3..607d511 100644
--- a/frontends/gtk/res/tabcontents.gtk3.ui
+++ b/frontends/gtk/res/tabcontents.gtk3.ui
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.0"/>
   <object class="GtkAdjustment" id="layouthadjustment">
     <property name="upper">100</property>
     <property name="step_increment">1</property>
@@ -11,82 +12,233 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
-  <object class="GtkGrid" id="tabContents">
+  <object class="GtkBox" id="tabBox">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="row_spacing">2</property>
-    <property name="column_spacing">2</property>
+    <property name="orientation">vertical</property>
     <child>
-      <object class="GtkLayout" id="layout">
+      <object class="GtkToolbar" id="toolbar">
         <property name="visible">True</property>
-        <property name="app_paintable">True</property>
         <property name="can_focus">False</property>
-        <property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 
| GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | 
GDK_STRUCTURE_MASK | GDK_SCROLL_MASK</property>
-        <property name="hadjustment">layouthadjustment</property>
-        <property name="vadjustment">layoutvadjustment</property>
+        <property name="toolbar_style">both</property>
       </object>
       <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">0</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">1</property>
       </packing>
     </child>
     <child>
-      <object class="GtkScrollbar" id="vscrollbar">
-        <property name="visible">True</property>
+      <object class="GtkToolbar" id="searchbar">
         <property name="can_focus">False</property>
-        <property name="vexpand">True</property>
-        <property name="orientation">vertical</property>
-        <property name="adjustment">layoutvadjustment</property>
+        <property name="toolbar_style">both</property>
+        <child>
+          <object class="GtkToolButton" id="closeSearchButton">
+            <property name="use_action_appearance">False</property>
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">gtk-close</property>
+            <property name="stock_id">gtk-close</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">True</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolItem" id="searchLabelItem">
+            <property name="use_action_appearance">False</property>
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkLabel" id="searchlabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xpad">4</property>
+                <property name="label" translatable="yes">Match</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolItem" id="toolSearch">
+            <property name="use_action_appearance">False</property>
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkEntry" id="searchEntry">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">●</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolButton" id="searchBackButton">
+            <property name="use_action_appearance">False</property>
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Search _Back</property>
+            <property name="use_underline">True</property>
+            <property name="stock_id">gtk-go-back</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">True</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolButton" id="searchForwardButton">
+            <property name="use_action_appearance">False</property>
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Search 
_Forward</property>
+            <property name="use_underline">True</property>
+            <property name="stock_id">gtk-go-forward</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">True</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolItem" id="checkAllSearchItem">
+            <property name="use_action_appearance">False</property>
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkCheckButton" id="checkAllSearch">
+                <property name="label" translatable="yes">All</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolItem" id="caseSensItem">
+            <property name="use_action_appearance">False</property>
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkCheckButton" id="caseSensButton">
+                <property name="label" translatable="yes">Case</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">False</property>
+          </packing>
+        </child>
       </object>
       <packing>
-        <property name="left_attach">1</property>
-        <property name="top_attach">0</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">2</property>
       </packing>
     </child>
     <child>
-      <object class="GtkPaned" id="hpaned1">
+      <object class="GtkGrid" id="tabContents">
         <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="hexpand">True</property>
+        <property name="can_focus">False</property>
+        <property name="row_spacing">2</property>
+        <property name="column_spacing">2</property>
         <child>
-          <object class="GtkLabel" id="status_bar">
+          <object class="GtkLayout" id="layout">
             <property name="visible">True</property>
+            <property name="app_paintable">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">0</property>
-            <property name="xpad">4</property>
-            <property name="label" translatable="yes">Status</property>
-            <property name="single_line_mode">True</property>
+            <property name="events">GDK_EXPOSURE_MASK | 
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK 
| GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | 
GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK | GDK_SCROLL_MASK</property>
+            <property name="hadjustment">layouthadjustment</property>
+            <property name="vadjustment">layoutvadjustment</property>
           </object>
           <packing>
-            <property name="resize">False</property>
-            <property name="shrink">True</property>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
           </packing>
         </child>
         <child>
-          <object class="GtkScrollbar" id="hscrollbar">
+          <object class="GtkScrollbar" id="vscrollbar">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="adjustment">layouthadjustment</property>
+            <property name="vexpand">True</property>
+            <property name="orientation">vertical</property>
+            <property name="adjustment">layoutvadjustment</property>
           </object>
           <packing>
-            <property name="resize">True</property>
-            <property name="shrink">True</property>
+            <property name="left_attach">1</property>
+            <property name="top_attach">0</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkPaned" id="hpaned1">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+            <child>
+              <object class="GtkLabel" id="status_bar">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xpad">4</property>
+                <property name="label" translatable="yes">Status</property>
+                <property name="single_line_mode">True</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="resize">False</property>
+                <property name="shrink">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkScrollbar" id="hscrollbar">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="adjustment">layouthadjustment</property>
+              </object>
+              <packing>
+                <property name="resize">True</property>
+                <property name="shrink">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
       </object>
       <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">1</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">3</property>
       </packing>
     </child>
-    <child>
-      <placeholder/>
-    </child>
   </object>
 </interface>
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index ee08cc1..c739b3e 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -115,30 +115,17 @@ struct nsgtk_scaffolding {
 
        /** scaffold container window */
        GtkWindow *window;
-       bool fullscreen; /**< flag for the scaffold window fullscreen status */
+       /** flag for the scaffold window fullscreen status */
+       bool fullscreen;
 
        /** tab widget holding displayed pages */
        GtkNotebook *notebook;
 
-       /** entry widget holding the url of the current displayed page */
-       GtkWidget *url_bar;
-       GtkEntryCompletion *url_bar_completion; /**< Completions for url_bar */
-
-       /** Activity throbber */
-       GtkImage *throbber;
-       int throb_frame; /**< Current frame of throbber animation */
-
+       /** In page text search context */
        struct gtk_search *search;
-       /** Web search widget */
-       GtkWidget *webSearchEntry;
 
-       /** controls toolbar */
-       GtkToolbar *tool_bar;
-       struct nsgtk_button_connect *buttons[PLACEHOLDER_BUTTON];
-       int offset;
-       int toolbarmem;
-       int toolbarbase;
-       int historybase;
+       /** controls toolbar context */
+       struct nsgtk_toolbar *toolbar;
 
        /** menu bar hierarchy */
        struct nsgtk_bar_submenu *menu_bar;
@@ -1868,9 +1855,7 @@ static void nsgtk_scaffolding_toolbar_init(struct 
nsgtk_scaffolding *g)
        g->buttons[p##_BUTTON]->main = g->menu_bar->q->r##_menuitem;\
        g->buttons[p##_BUTTON]->rclick = g->menu_popup->q->r##_menuitem;\
        g->buttons[p##_BUTTON]->mhandler = nsgtk_on_##r##_activate_menu;\
-       g->buttons[p##_BUTTON]->bhandler = nsgtk_on_##r##_activate_button;\
-       g->buttons[p##_BUTTON]->dataplus = nsgtk_toolbar_##r##_button_data;\
-       g->buttons[p##_BUTTON]->dataminus = 
nsgtk_toolbar_##r##_toolbar_button_data
+       g->buttons[p##_BUTTON]->bhandler = nsgtk_on_##r##_activate_button;
 
 #define ITEM_SUB(p, q, r, s)\
        g->buttons[p##_BUTTON]->main =\
@@ -1880,34 +1865,14 @@ static void nsgtk_scaffolding_toolbar_init(struct 
nsgtk_scaffolding *g)
        g->buttons[p##_BUTTON]->mhandler =\
                        nsgtk_on_##s##_activate_menu;\
        g->buttons[p##_BUTTON]->bhandler =\
-                       nsgtk_on_##s##_activate_button;\
-       g->buttons[p##_BUTTON]->dataplus =\
-                       nsgtk_toolbar_##s##_button_data;\
-       g->buttons[p##_BUTTON]->dataminus =\
-                       nsgtk_toolbar_##s##_toolbar_button_data
+                       nsgtk_on_##s##_activate_button;
 
 #define ITEM_BUTTON(p, q)\
        g->buttons[p##_BUTTON]->bhandler =\
-                       nsgtk_on_##q##_activate;\
-       g->buttons[p##_BUTTON]->dataplus =\
-                       nsgtk_toolbar_##q##_button_data;\
-       g->buttons[p##_BUTTON]->dataminus =\
-                       nsgtk_toolbar_##q##_toolbar_button_data
-
+                       nsgtk_on_##q##_activate;
 #define ITEM_POP(p, q)                                 \
        g->buttons[p##_BUTTON]->popup = g->menu_popup->q##_menuitem
 
-#define SENSITIVITY(q)                         \
-       g->buttons[q##_BUTTON]->sensitivity = false
-
-#define ITEM_ITEM(p, q)\
-       g->buttons[p##_ITEM]->dataplus =\
-                       nsgtk_toolbar_##q##_button_data;\
-       g->buttons[p##_ITEM]->dataminus =\
-                       nsgtk_toolbar_##q##_toolbar_button_data
-
-       ITEM_ITEM(WEBSEARCH, websearch);
-       ITEM_ITEM(THROBBER, throbber);
        ITEM_MAIN(NEWWINDOW, file_submenu, newwindow);
        ITEM_MAIN(NEWTAB, file_submenu, newtab);
        ITEM_MAIN(OPENFILE, file_submenu, openfile);
@@ -1964,27 +1929,11 @@ static void nsgtk_scaffolding_toolbar_init(struct 
nsgtk_scaffolding *g)
        ITEM_SUB(SAVEDOMTREE, tools_submenu, developer, debugdomtree);
        ITEM_BUTTON(HISTORY, history);
 
-       /* disable items that make no sense initially, as well as
-        * as-yet-unimplemented items */
-       SENSITIVITY(BACK);
-       SENSITIVITY(FORWARD);
-       SENSITIVITY(STOP);
-       SENSITIVITY(PRINTPREVIEW);
-       SENSITIVITY(DELETE);
-       SENSITIVITY(DRAWFILE);
-       SENSITIVITY(POSTSCRIPT);
-       SENSITIVITY(NEXTTAB);
-       SENSITIVITY(PREVTAB);
-       SENSITIVITY(CLOSETAB);
-#ifndef WITH_PDF_EXPORT
-       SENSITIVITY(PDF);
-#endif
 
 #undef ITEM_MAIN
 #undef ITEM_SUB
 #undef ITEM_BUTTON
 #undef ITEM_POP
-#undef SENSITIVITY
 
 }
 
@@ -2012,64 +1961,87 @@ static void 
nsgtk_scaffolding_initial_sensitivity(struct nsgtk_scaffolding *g)
        
gtk_widget_set_sensitive(GTK_WIDGET(g->menu_bar->view_submenu->images_menuitem),
 FALSE);
 }
 
-
-void nsgtk_scaffolding_toolbars(struct nsgtk_scaffolding *g, int tbi)
+/**
+ * update search toolbar size and style
+ */
+static nserror nsgtk_search_update(struct gtk_search *search)
 {
-       switch (tbi) {
-               /* case 0 is 'unset' [from fresh install / clearing options]
-                * see above */
+       switch (nsoption_int(button_type)) {
 
        case 1: /* Small icons */
-               /* main toolbar */
-               gtk_toolbar_set_style(GTK_TOOLBAR(g->tool_bar),
+               gtk_toolbar_set_style(GTK_TOOLBAR(search->bar),
                                      GTK_TOOLBAR_ICONS);
-               gtk_toolbar_set_icon_size(GTK_TOOLBAR(g->tool_bar),
-                                         GTK_ICON_SIZE_SMALL_TOOLBAR);
-               /* search toolbar */
-               gtk_toolbar_set_style(GTK_TOOLBAR(g->search->bar),
-                                     GTK_TOOLBAR_ICONS);
-               gtk_toolbar_set_icon_size(GTK_TOOLBAR(g->search->bar),
+               gtk_toolbar_set_icon_size(GTK_TOOLBAR(search->bar),
                                          GTK_ICON_SIZE_SMALL_TOOLBAR);
                break;
 
        case 2: /* Large icons */
-               gtk_toolbar_set_style(GTK_TOOLBAR(g->tool_bar),
+               gtk_toolbar_set_style(GTK_TOOLBAR(search->bar),
                                      GTK_TOOLBAR_ICONS);
-               gtk_toolbar_set_icon_size(GTK_TOOLBAR(g->tool_bar),
-                                         GTK_ICON_SIZE_LARGE_TOOLBAR);
-               /* search toolbar */
-               gtk_toolbar_set_style(GTK_TOOLBAR(g->search->bar),
-                                     GTK_TOOLBAR_ICONS);
-               gtk_toolbar_set_icon_size(GTK_TOOLBAR(g->search->bar),
+               gtk_toolbar_set_icon_size(GTK_TOOLBAR(search->bar),
                                          GTK_ICON_SIZE_LARGE_TOOLBAR);
                break;
 
        case 3: /* Large icons with text */
-               gtk_toolbar_set_style(GTK_TOOLBAR(g->tool_bar),
+               gtk_toolbar_set_style(GTK_TOOLBAR(search->bar),
                                      GTK_TOOLBAR_BOTH);
-               gtk_toolbar_set_icon_size(GTK_TOOLBAR(g->tool_bar),
-                                         GTK_ICON_SIZE_LARGE_TOOLBAR);
-               /* search toolbar */
-               gtk_toolbar_set_style(GTK_TOOLBAR(g->search->bar),
-                                     GTK_TOOLBAR_BOTH);
-               gtk_toolbar_set_icon_size(GTK_TOOLBAR(g->search->bar),
+               gtk_toolbar_set_icon_size(GTK_TOOLBAR(search->bar),
                                          GTK_ICON_SIZE_LARGE_TOOLBAR);
                break;
 
        case 4: /* Text icons only */
-               gtk_toolbar_set_style(GTK_TOOLBAR(g->tool_bar),
-                                     GTK_TOOLBAR_TEXT);
-               /* search toolbar */
-               gtk_toolbar_set_style(GTK_TOOLBAR(g->search->bar),
+               gtk_toolbar_set_style(GTK_TOOLBAR(search->bar),
                                      GTK_TOOLBAR_TEXT);
        default:
                break;
        }
+       return NSERROR_OK;
 }
 
+
+static nserror
+nsgtk_search_create(GtkBuilder *builder, struct gtk_search **search_out)
+{
+       struct gtk_search *search;
+
+       search = malloc(sizeof(struct gtk_search));
+       if (search == NULL) {
+               return NSERROR_NOMEM;
+       }
+
+       search->bar = GTK_TOOLBAR(gtk_builder_get_object(builder, "searchbar"));
+       search->entry = 
GTK_ENTRY(gtk_builder_get_object(builder,"searchEntry"));
+
+       search->buttons[0] = GTK_TOOL_BUTTON(gtk_builder_get_object(
+                                               builder,"searchBackButton"));
+       search->buttons[1] = GTK_TOOL_BUTTON(gtk_builder_get_object(
+                                               builder,"searchForwardButton"));
+       search->buttons[2] = GTK_TOOL_BUTTON(gtk_builder_get_object(
+                                               builder,"closeSearchButton"));
+       search->checkAll = GTK_CHECK_BUTTON(gtk_builder_get_object(
+                                               builder,"checkAllSearch"));
+       search->caseSens = GTK_CHECK_BUTTON(gtk_builder_get_object(
+                                               builder,"caseSensButton"));
+
+       nsgtk_search_update(search);    
+
+       *search_out = search;
+       return NSERROR_OK;
+}
+
+
+/* exported interface documented in gtk/scaffolding.h */
+void nsgtk_scaffolding_toolbars(struct nsgtk_scaffolding *g)
+{
+       nsgtk_toolbar_update(g->toolbar);
+       nsgtk_search_update(g->search);
+}
+
+
 /* exported interface documented in gtk/scaffolding.h */
 struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
 {
+       nserror res;
        struct nsgtk_scaffolding *gs;
        int i;
        GtkAccelGroup *group;
@@ -2092,58 +2064,26 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct 
gui_window *toplevel)
 
        gtk_builder_connect_signals(gs->builder, NULL);
 
-/** Obtain a GTK widget handle from UI builder object */
-#define GET_WIDGET(x) GTK_WIDGET (gtk_builder_get_object(gs->builder, (x)))
-
-       gs->window = GTK_WINDOW(GET_WIDGET("wndBrowser"));
-       gs->notebook = GTK_NOTEBOOK(GET_WIDGET("notebook"));
-       gs->tool_bar = GTK_TOOLBAR(GET_WIDGET("toolbar"));
+       gs->window = GTK_WINDOW(gtk_builder_get_object(builder, "wndBrowser"));
+       gs->notebook = GTK_NOTEBOOK(gtk_builder_get_object(builder, 
"notebook"));
 
-       gs->search = malloc(sizeof(struct gtk_search));
-       if (gs->search == NULL) {
+       res = nsgtk_toolbar_create(&gs->toolbar);
+       if (res != NSERROR_OK) {
                free(gs);
                return NULL;
        }
 
-       gs->search->bar = GTK_TOOLBAR(GET_WIDGET("searchbar"));
-       gs->search->entry = GTK_ENTRY(GET_WIDGET("searchEntry"));
-
-       gs->search->buttons[0] = 
GTK_TOOL_BUTTON(GET_WIDGET("searchBackButton"));
-       gs->search->buttons[1] = 
GTK_TOOL_BUTTON(GET_WIDGET("searchForwardButton"));
-       gs->search->buttons[2] = 
GTK_TOOL_BUTTON(GET_WIDGET("closeSearchButton"));
-       gs->search->checkAll = GTK_CHECK_BUTTON(GET_WIDGET("checkAllSearch"));
-       gs->search->caseSens = GTK_CHECK_BUTTON(GET_WIDGET("caseSensButton"));
-
-#undef GET_WIDGET
-
-       /* allocate buttons */
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               gs->buttons[i] = calloc(1, sizeof(struct nsgtk_button_connect));
-               if (gs->buttons[i] == NULL) {
-                       for (i-- ; i >= BACK_BUTTON; i--) {
-                               free(gs->buttons[i]);
-                       }
-                       free(gs);
-                       return NULL;
-               }
-               gs->buttons[i]->location = -1;
-               gs->buttons[i]->sensitivity = true;
+       res = nsgtk_search_create(&gs->search);
+       if (res != NSERROR_OK) {
+               free(gs);
+               return NULL;
        }
-
-       /* here custom toolbutton adding code */
-       gs->offset = 0;
-       gs->toolbarmem = 0;
-       gs->toolbarbase = 0;
-       gs->historybase = 0;
-       nsgtk_toolbar_customization_load(gs);
-       nsgtk_toolbar_set_physical(gs);
-
+       
        group = gtk_accel_group_new();
        gtk_window_add_accel_group(gs->window, group);
 
        gs->menu_bar = 
nsgtk_menu_bar_create(GTK_MENU_SHELL(gtk_builder_get_object(gs->builder, 
"menubar")), group);
 
-
        /* set this window's size and position to what's in the options, or
         * or some sensible default if they're not set yet.
         */
@@ -2162,64 +2102,20 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct 
gui_window *toplevel)
                gtk_window_set_default_size(gs->window, 1000, 700);
        }
 
-       /* Default toolbar button type uses system defaults */
-       if (nsoption_int(button_type) == 0) {
-               GtkSettings *settings = gtk_settings_get_default();
-               GtkIconSize tooliconsize;
-               GtkToolbarStyle toolbarstyle;
-
-               g_object_get(settings,
-                            "gtk-toolbar-icon-size", &tooliconsize,
-                            "gtk-toolbar-style", &toolbarstyle, NULL);
-
-               switch (toolbarstyle) {
-               case GTK_TOOLBAR_ICONS:
-                       if (tooliconsize == GTK_ICON_SIZE_SMALL_TOOLBAR) {
-                               nsoption_set_int(button_type, 1);
-                       } else {
-                               nsoption_set_int(button_type, 2);
-                       }
-                       break;
-
-               case GTK_TOOLBAR_TEXT:
-                       nsoption_set_int(button_type, 4);
-                       break;
-
-               case GTK_TOOLBAR_BOTH:
-               case GTK_TOOLBAR_BOTH_HORIZ:
-                       /* no labels in default configuration */
-               default:
-                       /* No system default, so use large icons */
-                       nsoption_set_int(button_type, 2);
-                       break;
-               }
-       }
-
-       nsgtk_scaffolding_toolbars(gs, nsoption_int(button_type));
 
-       gtk_toolbar_set_show_arrow(gs->tool_bar, TRUE);
-       gtk_widget_show_all(GTK_WIDGET(gs->tool_bar));
        nsgtk_tab_init(gs);
 
-       gtk_widget_set_size_request(GTK_WIDGET(
-                       gs->buttons[HISTORY_BUTTON]->button), 20, -1);
-
 
-       /* set up URL bar completion */
-       gs->url_bar_completion = nsgtk_url_entry_completion_new(gs);
 
-       /* set up the throbber. */
-       gs->throb_frame = 0;
-
-
-#define CONNECT(obj, sig, callback, ptr) \
-       g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
 
        g_signal_connect_after(gs->notebook, "page-added",
                        G_CALLBACK(nsgtk_window_tabs_add), gs);
        g_signal_connect_after(gs->notebook, "page-removed",
                        G_CALLBACK(nsgtk_window_tabs_remove), gs);
 
+#define CONNECT(obj, sig, callback, ptr) \
+       g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
+
        /* connect main window signals to their handlers. */
        CONNECT(gs->window, "delete-event",
                scaffolding_window_delete_event, gs);
@@ -2251,8 +2147,9 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct 
gui_window *toplevel)
        CONNECT(gs->search->caseSens, "toggled",
                nsgtk_search_entry_changed, gs);
 
-       CONNECT(gs->tool_bar, "popup-context-menu",
-               nsgtk_window_tool_bar_clicked, gs);
+       /** \todo fix popup menu */
+       //CONNECT(gs->tool_bar, "popup-context-menu",
+       //      nsgtk_window_tool_bar_clicked, gs);
 
        /* create popup menu */
        gs->menu_popup = nsgtk_new_scaffolding_popup(gs, group);
@@ -2547,13 +2444,6 @@ GtkToolbar *nsgtk_scaffolding_toolbar(struct 
nsgtk_scaffolding *g)
 }
 
 /* exported interface documented in gtk/scaffolding.h */
-struct nsgtk_button_connect *
-nsgtk_scaffolding_button(struct nsgtk_scaffolding *g, int i)
-{
-       return g->buttons[i];
-}
-
-/* exported interface documented in gtk/scaffolding.h */
 struct gtk_search *nsgtk_scaffolding_search(struct nsgtk_scaffolding *g)
 {
        return g->search;
@@ -2580,15 +2470,6 @@ void nsgtk_scaffolding_reset_offset(struct 
nsgtk_scaffolding *g)
        g->offset = 0;
 }
 
-/* exported interface documented in gtk/scaffolding.h */
-void nsgtk_scaffolding_update_url_bar_ref(struct nsgtk_scaffolding *g)
-{
-       g->url_bar = GTK_WIDGET(gtk_bin_get_child(GTK_BIN(
-                       nsgtk_scaffolding_button(g, URL_BAR_ITEM)->button)));
-
-       gtk_entry_set_completion(GTK_ENTRY(g->url_bar),
-                       g->url_bar_completion);
-}
 
 /* exported interface documented in gtk/scaffolding.h */
 void nsgtk_scaffolding_update_throbber_ref(struct nsgtk_scaffolding *g)
@@ -2753,8 +2634,7 @@ void nsgtk_scaffolding_toolbar_size_allocate(GtkWidget 
*widget,
        if (i == -1)
                return;
        if ((g->toolbarmem == alloc->x) ||
-                       (g->buttons[i]->location <
-                       g->buttons[HISTORY_BUTTON]->location))
+           (g->buttons[i]->location < g->buttons[HISTORY_BUTTON]->location))
        /* no reallocation after first adjustment, no reallocation for buttons
         * left of history button */
                return;
@@ -2767,8 +2647,7 @@ void nsgtk_scaffolding_toolbar_size_allocate(GtkWidget 
*widget,
                if (g->offset == 0)
                        g->offset = alloc->width - 20;
                alloc->width = 20;
-       } else if (g->buttons[i]->location <=
-                       g->buttons[URL_BAR_ITEM]->location) {
+       } else if (g->buttons[i]->location <= 
g->buttons[URL_BAR_ITEM]->location) {
                alloc->x -= g->offset;
                if (i == URL_BAR_ITEM)
                        alloc->width += g->offset;
diff --git a/frontends/gtk/scaffolding.h b/frontends/gtk/scaffolding.h
index 7f7657e..a3e6155 100644
--- a/frontends/gtk/scaffolding.h
+++ b/frontends/gtk/scaffolding.h
@@ -30,60 +30,6 @@ struct nsurl;
 
 extern struct gui_search_web_table *nsgtk_search_web_table;
 
-typedef enum {
-       BACK_BUTTON = 0,
-       HISTORY_BUTTON,
-       FORWARD_BUTTON,
-       STOP_BUTTON,
-       RELOAD_BUTTON,
-       HOME_BUTTON,
-       URL_BAR_ITEM,
-       WEBSEARCH_ITEM,
-       THROBBER_ITEM,
-       NEWWINDOW_BUTTON,
-       NEWTAB_BUTTON,
-       OPENFILE_BUTTON,
-       CLOSETAB_BUTTON,
-       CLOSEWINDOW_BUTTON,
-       SAVEPAGE_BUTTON,
-       PDF_BUTTON,
-       PLAINTEXT_BUTTON,
-       DRAWFILE_BUTTON,
-       POSTSCRIPT_BUTTON,
-       PRINTPREVIEW_BUTTON,
-       PRINT_BUTTON,
-       QUIT_BUTTON,
-       CUT_BUTTON,
-       COPY_BUTTON,
-       PASTE_BUTTON,
-       DELETE_BUTTON,
-       SELECTALL_BUTTON,
-       FIND_BUTTON,
-       PREFERENCES_BUTTON,
-       ZOOMPLUS_BUTTON,
-       ZOOMMINUS_BUTTON,
-       ZOOMNORMAL_BUTTON,
-       FULLSCREEN_BUTTON,
-       VIEWSOURCE_BUTTON,
-       DOWNLOADS_BUTTON,
-       SAVEWINDOWSIZE_BUTTON,
-       TOGGLEDEBUGGING_BUTTON,
-       SAVEBOXTREE_BUTTON,
-       SAVEDOMTREE_BUTTON,
-       LOCALHISTORY_BUTTON,
-       GLOBALHISTORY_BUTTON,
-       ADDBOOKMARKS_BUTTON,
-       SHOWBOOKMARKS_BUTTON,
-       SHOWCOOKIES_BUTTON,
-       OPENLOCATION_BUTTON,
-       NEXTTAB_BUTTON,
-       PREVTAB_BUTTON,
-       CONTENTS_BUTTON,
-       GUIDE_BUTTON,
-       INFO_BUTTON,
-       ABOUT_BUTTON,
-       PLACEHOLDER_BUTTON /* size indicator; array maximum indices */
-} nsgtk_toolbar_button;    /* PLACEHOLDER_BUTTON - 1 */
 
 struct gtk_history_window {
        struct nsgtk_scaffolding        *g;
@@ -100,18 +46,6 @@ struct gtk_search {
        GtkCheckButton                  *caseSens;
 };
 
-struct nsgtk_button_connect {
-       GtkToolItem *button;
-       int         location; /* in toolbar */
-       bool        sensitivity;
-       GtkWidget   *main; /* left click menu entry */
-       GtkWidget   *rclick; /* right click menu */
-       GtkWidget   *popup; /* popup menu entry */
-       void        *mhandler; /* menu item clicked */
-       void        *bhandler; /* button clicked */
-       void        *dataplus; /* customization -> toolbar */
-       void        *dataminus; /* customization -> store */
-};
 
 /**
  * create a new scaffolding for a window.
@@ -156,8 +90,6 @@ GtkWidget *nsgtk_scaffolding_websearch(struct 
nsgtk_scaffolding *g);
 GtkToolbar *nsgtk_scaffolding_toolbar(struct nsgtk_scaffolding *g);
 
 
-struct nsgtk_button_connect *nsgtk_scaffolding_button(struct nsgtk_scaffolding 
*g, int i);
-
 struct gtk_search *nsgtk_scaffolding_search(struct nsgtk_scaffolding *g);
 
 GtkMenuBar *nsgtk_scaffolding_menu_bar(struct nsgtk_scaffolding *g);
@@ -180,8 +112,6 @@ void nsgtk_scaffolding_reset_offset(struct 
nsgtk_scaffolding *g);
  */
 struct nsgtk_scaffolding *nsgtk_scaffolding_iterate(struct nsgtk_scaffolding 
*g);
 
-void nsgtk_scaffolding_update_url_bar_ref(struct nsgtk_scaffolding *g);
-
 void nsgtk_scaffolding_update_throbber_ref(struct nsgtk_scaffolding *g);
 
 void nsgtk_scaffolding_update_websearch_ref(struct nsgtk_scaffolding *g);
@@ -245,6 +175,9 @@ nserror gui_window_set_url(struct gui_window *g, struct 
nsurl *url);
 void gui_window_start_throbber(struct gui_window *g);
 void gui_window_stop_throbber(struct gui_window *g);
 
-void nsgtk_scaffolding_toolbars(struct nsgtk_scaffolding *g, int tbi);
+/**
+ * toolbar style changed
+ */
+void nsgtk_scaffolding_toolbars(struct nsgtk_scaffolding *g);
 
 #endif /* NETSURF_GTK_SCAFFOLDING_H */
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 4ca03a1..02b1e66 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -16,6 +16,11 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+/**
+ * \file
+ * implementatio of toolbar to control browsing context
+ */
+
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -36,13 +41,68 @@
 #include "gtk/window.h"
 #include "gtk/compat.h"
 #include "gtk/resources.h"
+#include "gtk/toolbar_items.h"
 #include "gtk/toolbar.h"
 
+/** button location indicating button is not to be shown */
+#define INACTIVE_LOCATION (-1)
+
+/**
+ * toolbar item context
+ */
+struct nsgtk_toolbar_item {
+       GtkToolItem *button;
+       int         location; /* in toolbar */
+       bool        sensitivity;
+       GtkWidget   *main; /* left click menu entry */
+       GtkWidget   *rclick; /* right click menu */
+       GtkWidget   *popup; /* popup menu entry */
+       void        *mhandler; /* menu item clicked */
+       void        *bhandler; /* button clicked */
+       void        *dataplus; /* customization -> toolbar */
+       void        *dataminus; /* customization -> store */
+};
+
+
+/**
+ * control toolbar context
+ */
+struct nsgtk_toolbar {
+       /** gtk toolbar widget */
+       GtkToolbar *widget;
+
+       struct nsgtk_toolbar_item *buttons[PLACEHOLDER_BUTTON];
+       int offset;
+       int toolbarmem;
+       int toolbarbase;
+       int historybase;
+
+       /** entry widget holding the url of the current displayed page */
+       GtkWidget *url_bar;
+
+       /** Completions for url_bar */
+       GtkEntryCompletion *url_bar_completion;
+
+       /** Activity throbber */
+       GtkImage *throbber;
+
+       /** Current frame of throbber animation */
+       int throb_frame;
+
+       /** Web search widget */
+       GtkWidget *webSearchEntry;
+
+};
+
+
 static GtkTargetEntry entry = {(char *)"nsgtk_button_data",
                GTK_TARGET_SAME_APP, 0};
 
 static bool edit_mode = false;
 
+/**
+ * toolbar customization window context
+ */
 struct nsgtk_toolbar_custom_store {
        GtkWidget *window;
        GtkWidget *store_buttons[PLACEHOLDER_BUTTON];
@@ -54,44 +114,534 @@ struct nsgtk_toolbar_custom_store {
        int currentbutton;
        bool fromstore;
 };
+
 /* the number of buttons that fit in the width of the store window */
 #define NSGTK_STORE_WIDTH 6
 
-/* the 'standard' width of a button that makes sufficient of its label
-visible */
-#define NSGTK_BUTTON_WIDTH 111
+/* the 'standard' width of a button that makes sufficient of its label
+visible */
+#define NSGTK_BUTTON_WIDTH 111
+
+/* the 'standard' height of a button that fits as many toolbars as
+possible into the store */
+#define NSGTK_BUTTON_HEIGHT 70
+
+/* the 'normal' width of the websearch bar */
+#define NSGTK_WEBSEARCH_WIDTH 150
+
+static struct nsgtk_toolbar_custom_store store;
+static struct nsgtk_toolbar_custom_store *window = &store;
+
+
+enum image_sets {
+       IMAGE_SET_MAIN_MENU = 0,
+       IMAGE_SET_RCLICK_MENU,
+       IMAGE_SET_POPUP_MENU,
+       IMAGE_SET_BUTTONS,
+       IMAGE_SET_COUNT
+};
+
+typedef enum search_buttons {
+       SEARCH_BACK_BUTTON = 0,
+       SEARCH_FORWARD_BUTTON,
+       SEARCH_CLOSE_BUTTON,
+       SEARCH_BUTTONS_COUNT
+} nsgtk_search_buttons;
+
+struct nsgtk_theme {
+       GtkImage *image[PLACEHOLDER_BUTTON];
+       GtkImage *searchimage[SEARCH_BUTTONS_COUNT];
+       /* apng throbber element */
+};
+
+
+/* define data plus and data minus handlers */
+#define TOOLBAR_ITEM(identifier, name, sensitivity)                    \
+static gboolean                                                                
\
+nsgtk_toolbar_##name##_data_plus(GtkWidget *widget,                    \
+                                GdkDragContext *cont,                  \
+                                GtkSelectionData *selection,           \
+                                guint info,                            \
+                                guint time,                            \
+                                gpointer data)                         \
+{                                                                      \
+       window->currentbutton = identifier;                             \
+       window->fromstore = true;                                       \
+       return TRUE;                                                    \
+}                                                                      \
+static gboolean                                                                
\
+nsgtk_toolbar_##name##_data_minus(GtkWidget *widget,                   \
+                                 GdkDragContext *cont,                 \
+                                 GtkSelectionData *selection,          \
+                                 guint info,                           \
+                                 guint time,                           \
+                                 gpointer data)                        \
+{                                                                      \
+       window->currentbutton = identifier;                             \
+       window->fromstore = false;                                      \
+       return TRUE;                                                    \
+}
+
+#include "gtk/toolbar_items.h"
+
+#undef TOOLBAR_ITEM
+
+
+/**
+ * Apply the user toolbar button settings from configuration
+ *
+ * GTK specific user option string is a set of fields arranged as
+ * [itemreference];[itemlocation]|[itemreference];[itemlocation]| etc
+ *
+ * \param tb The toolbar to apply customization to
+ * \param NSERROR_OK on success else error code.
+ */
+static nserror
+apply_user_button_customization(struct nsgtk_toolbar *tb)
+{
+       int i, ii;
+       char *buffer;
+       char *buffer1, *subbuffer, *ptr = NULL, *pter = NULL;
+
+       /* set all button locations to inactive */
+       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
+               tb->buttons[i]->location = INACTIVE_LOCATION;
+       }
+
+       /* if no user config is present apply the defaults */
+       if (nsoption_charp(toolbar_order) == NULL) {
+               tb->buttons[BACK_BUTTON]->location = 0;
+               tb->buttons[HISTORY_BUTTON]->location = 1;
+               tb->buttons[FORWARD_BUTTON]->location = 2;
+               tb->buttons[STOP_BUTTON]->location = 3;
+               tb->buttons[RELOAD_BUTTON]->location = 4;
+               tb->buttons[URL_BAR_ITEM]->location = 5;
+               tb->buttons[WEBSEARCH_ITEM]->location = 6;
+               tb->buttons[THROBBER_ITEM]->location = 7;
+
+               return NSERROR_OK;
+       }
+
+       buffer = strdup(nsoption_charp(toolbar_order));
+       if (buffer == NULL) {
+               return NSERROR_NOMEM;
+       }
+
+       i = BACK_BUTTON;
+       ii = BACK_BUTTON;
+       buffer1 = strtok_r(buffer, "|", &ptr);
+       while (buffer1 != NULL) {
+               subbuffer = strtok_r(buffer1, ";", &pter);
+               if (subbuffer != NULL) {
+                       i = atoi(subbuffer);
+                       subbuffer = strtok_r(NULL, ";", &pter);
+                       if (subbuffer != NULL) {
+                               ii = atoi(subbuffer);
+                               if ((i >= BACK_BUTTON) &&
+                                   (i < PLACEHOLDER_BUTTON) &&
+                                   (ii >= -1) &&
+                                   (ii < PLACEHOLDER_BUTTON)) {
+                                       tb->buttons[i]->location = ii;
+                               }
+                       }
+               }
+               buffer1 = strtok_r(NULL, "|", &ptr);
+       }
+
+       free(buffer);
+       return NSERROR_OK;
+}
+
+
+/**
+ * widget factory for creation of toolbar item widgets
+ *
+ * \param i the id of the widget
+ * \param theme the theme to make the widgets from
+ * \return gtk widget
+ */
+static GtkWidget *
+make_toolbar_item(nsgtk_toolbar_button i, struct nsgtk_theme *theme)
+{
+       GtkWidget *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_WIDGET(gtk_tool_button_new(GTK_WIDGET(  \
+                                          theme->image[p##_BUTTON]), label)); \
+                       free(label);                                    \
+               } else {                                                \
+                       w = GTK_WIDGET(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
+
+       case HISTORY_BUTTON:
+               w = GTK_WIDGET(gtk_tool_button_new(GTK_WIDGET(
+                               theme->image[HISTORY_BUTTON]), "H"));
+               break;
+
+       case URL_BAR_ITEM: {
+               GtkWidget *entry = nsgtk_entry_new();
+               w = GTK_WIDGET(gtk_tool_item_new());
+
+               if ((entry == NULL) || (w == NULL)) {
+                       nsgtk_warning(messages_get("NoMemory"), 0);
+                       return NULL;
+               }
+
+               gtk_container_add(GTK_CONTAINER(w), entry);
+               gtk_tool_item_set_expand(GTK_TOOL_ITEM(w), TRUE);
+               break;
+       }
+
+       case THROBBER_ITEM: {
+               nserror res;
+               GdkPixbuf *pixbuf;
+               res = nsgtk_throbber_get_frame(0, &pixbuf);
+               if (res != NSERROR_OK) {
+                       return NULL;
+               }
+
+               if (edit_mode) {
+                       w = GTK_WIDGET(gtk_tool_button_new(
+                               GTK_WIDGET(gtk_image_new_from_pixbuf(pixbuf)),
+                               "[throbber]"));
+               } else {
+                       GtkWidget *image;
+
+                       w = GTK_WIDGET(gtk_tool_item_new());
+
+                       image = gtk_image_new_from_pixbuf(pixbuf);
+                       if (image != NULL) {
+                               nsgtk_widget_set_alignment(image,
+                                                          GTK_ALIGN_CENTER,
+                                                          GTK_ALIGN_CENTER);
+                               nsgtk_widget_set_margins(image, 3, 0);
+
+                               gtk_container_add(GTK_CONTAINER(w), image);
+                       }
+               }
+               break;
+       }
+
+       case WEBSEARCH_ITEM: {
+               if (edit_mode)
+                       return GTK_WIDGET(gtk_tool_button_new(GTK_WIDGET(
+                                       
nsgtk_image_new_from_stock(NSGTK_STOCK_FIND,
+                                       GTK_ICON_SIZE_LARGE_TOOLBAR)),
+                                       "[websearch]"));
+
+               GtkWidget *entry = nsgtk_entry_new();
+
+               w = GTK_WIDGET(gtk_tool_item_new());
+
+               if ((entry == NULL) || (w == NULL)) {
+                       nsgtk_warning(messages_get("NoMemory"), 0);
+                       return NULL;
+               }
+
+               gtk_widget_set_size_request(entry, NSGTK_WEBSEARCH_WIDTH, -1);
+
+               nsgtk_entry_set_icon_from_stock(entry, GTK_ENTRY_ICON_PRIMARY,
+                                               NSGTK_STOCK_INFO);
+
+               gtk_container_add(GTK_CONTAINER(w), entry);
+               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_WIDGET(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)
+#undef MAKE_MENUBUTTON
+
+       default:
+               break;
+
+       }
+       return w;
+}
+
+
+/**
+ * append item to gtk toolbar container
+ *
+ * \param tb toolbar
+ * \param theme in use
+ * \param location item location being appended
+ * \return NSERROR_OK on success else error code.
+ */
+static nserror
+append_item_to_toolbar(struct nsgtk_toolbar *tb,
+                      struct nsgtk_theme *theme,
+                      int location)
+{
+       int bidx; /* button index */
+
+       for (bidx = BACK_BUTTON; bidx < PLACEHOLDER_BUTTON; bidx++) {
+
+               if (tb->buttons[bidx]->location == location) {
+
+                       tb->buttons[bidx]->button = GTK_TOOL_ITEM(
+                                       make_toolbar_item(bidx, theme));
+
+                       gtk_toolbar_insert(tb->widget,
+                                          tb->buttons[bidx]->button,
+                                          location);
+                       break;
+               }
+       }
+       return NSERROR_OK;
+}
+
+
+/**
+ * callback function to remove a widget from a container
+ */
+static void container_remove_widget(GtkWidget *widget, gpointer data)
+{
+       GtkContainer *container = GTK_CONTAINER(data);
+       gtk_container_remove(container, widget);
+}
+
+
+/**
+ * populates the gtk toolbar container with widgets in correct order
+ */
+static nserror populate_gtk_toolbar_widget(struct nsgtk_toolbar *tb)
+{
+       struct nsgtk_theme *theme; /* internal theme context */
+       int lidx; /* location index */
+
+       theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR, false);
+       if (theme == NULL) {
+               return NSERROR_NOMEM;
+       }
+
+       /* clear the toolbar container of all widgets */
+       gtk_container_foreach(GTK_CONTAINER(tb->widget),
+                             container_remove_widget,
+                             tb->widget);
+
+       /* add widgets to toolbar */
+       for (lidx = 0; lidx < PLACEHOLDER_BUTTON; lidx++) {
+               add_item_to_toolbar(tb, theme, lidx);
+       }
+
+       gtk_widget_show_all(GTK_WIDGET(tb->widget));
+       free(theme);
+
+       return NSERROR_OK;
+}
+
+/**
+ * create a toolbar item
+ *
+ * create a toolbar item and set up its default handlers
+ */
+static nserror
+toolbar_item_create(nsgtk_toolbar_button id,
+                   struct nsgtk_toolbar_item **item_out)
+{
+       struct nsgtk_toolbar_item *item;
+       item = calloc(1, sizeof(struct nsgtk_toolbar_item));
+       if (item == NULL) {
+               return NSERROR_NOMEM;
+       }
+       item->location = INACTIVE_LOCATION;
+                       
+       switch (id) {
+#define TOOLBAR_ITEM(identifier, name, snstvty)                                
\
+       case identifier:                                                \
+               item->sensitivity = snstvty;                            \
+               item->dataplus = nsgtk_toolbar_##name##_data_plus;      \
+               item->dataminus = nsgtk_toolbar_##name##_data_minus;    \
+               break;
+#include "gtk/toolbar_items.h"
+#undef TOOLBAR_ITEM
+       }
+
+        *item_out = item;
+        return NSERROR_OK;
+}
+
+/* exported interface documented in toolbar.h */
+nserror nsgtk_toolbar_create(GtkBuilder *builder, struct nsgtk_toolbar 
**tb_out)
+{
+       nserror res;
+       struct nsgtk_toolbar *tb;
+       int bidx; /* button index */
+
+       tb = calloc(1, sizeof(struct nsgtk_toolbar));
+       if (tb == NULL) {
+               return NSERROR_NOMEM;
+       }
+
+       tb->widget = GTK_TOOLBAR(gtk_builder_get_object(builder, "toolbar"));
+
+       /* allocate button contexts */
+       for (bidx = BACK_BUTTON; bidx < PLACEHOLDER_BUTTON; bidx++) {
+               res = toolbar_item_create(bidx, &tb->buttons[bidx]);
+               if (res != NSERROR_OK) {
+                       for (bidx-- ; bidx >= BACK_BUTTON; bidx--) {
+                               free(tb->buttons[bidx]);
+                       }
+                       free(tb);
+                       return res;
+               }
+       }
+
+       res = apply_user_button_customization(tb);
+       if (res != NSERROR_OK) {
+               free(tb);
+               return res;
+       }
+
+       res = populate_gtk_toolbar_widget(tb);
+       if (res != NSERROR_OK) {
+               free(tb);
+               return res;
+       }
+
+       res = nsgtk_toolbar_update(tb);
+       if (res != NSERROR_OK) {
+               free(tb);
+               return res;
+       }
+
+       gtk_toolbar_set_show_arrow(tb->widget, TRUE);
+       gtk_widget_show_all(GTK_WIDGET(tb->widget));
+
+       /* if there is a history widget set its size */
+       if (tb->buttons[HISTORY_BUTTON]->button != NULL) {
+               gtk_widget_set_size_request(GTK_WIDGET(
+                       tb->buttons[HISTORY_BUTTON]->button), 20, -1);
+       }
+
+       /* set up the throbber. */
+       tb->throb_frame = 0;
+
+       /* set up URL bar completion */
+       tb->url_bar_completion = nsgtk_url_entry_completion_new(gs);
+       
+       *tb_out = tb;
+       return NSERROR_OK;
+}
+
+
+/* exported interface documented in toolbar.h */
+nserror nsgtk_toolbar_destroy(struct nsgtk_toolbar *tb)
+{
+       /** \todo free buttons and destroy toolbar container (and widgets) */
+       free(tb);
+       return NSERROR_OK;
+}
+
+/* exported interface documented in toolbar.h */
+nserror nsgtk_toolbar_update(struct nsgtk_toolbar *tb)
+{
+       switch (nsoption_int(button_type)) {
 
-/* the 'standard' height of a button that fits as many toolbars as
-possible into the store */
-#define NSGTK_BUTTON_HEIGHT 70
+       case 1: /* Small icons */
+               gtk_toolbar_set_style(GTK_TOOLBAR(tb->widget),
+                                     GTK_TOOLBAR_ICONS);
+               gtk_toolbar_set_icon_size(GTK_TOOLBAR(tb->widget),
+                                         GTK_ICON_SIZE_SMALL_TOOLBAR);
+               break;
 
-/* the 'normal' width of the websearch bar */
-#define NSGTK_WEBSEARCH_WIDTH 150
+       case 2: /* Large icons */
+               gtk_toolbar_set_style(GTK_TOOLBAR(g->tool_bar),
+                                     GTK_TOOLBAR_ICONS);
+               gtk_toolbar_set_icon_size(GTK_TOOLBAR(g->tool_bar),
+                                         GTK_ICON_SIZE_LARGE_TOOLBAR);
+               break;
 
-static struct nsgtk_toolbar_custom_store store;
-static struct nsgtk_toolbar_custom_store *window = &store;
+       case 3: /* Large icons with text */
+               gtk_toolbar_set_style(GTK_TOOLBAR(g->tool_bar),
+                                     GTK_TOOLBAR_BOTH);
+               gtk_toolbar_set_icon_size(GTK_TOOLBAR(g->tool_bar),
+                                         GTK_ICON_SIZE_LARGE_TOOLBAR);
+               break;
 
+       case 4: /* Text icons only */
+               gtk_toolbar_set_style(GTK_TOOLBAR(g->tool_bar),
+                                     GTK_TOOLBAR_TEXT);
+               break;
 
-enum image_sets {
-       IMAGE_SET_MAIN_MENU = 0,
-       IMAGE_SET_RCLICK_MENU,
-       IMAGE_SET_POPUP_MENU,
-       IMAGE_SET_BUTTONS,
-       IMAGE_SET_COUNT
-};
+       default:
+               break;
+       }
 
-typedef enum search_buttons {
-       SEARCH_BACK_BUTTON = 0,
-       SEARCH_FORWARD_BUTTON,
-       SEARCH_CLOSE_BUTTON,
-       SEARCH_BUTTONS_COUNT
-} nsgtk_search_buttons;
+       return NSERROR_OK;
+}
 
-struct nsgtk_theme {
-       GtkImage *image[PLACEHOLDER_BUTTON];
-       GtkImage *searchimage[SEARCH_BUTTONS_COUNT];
-       /* apng throbber element */
-};
 
 /**
  * returns a string without its underscores
@@ -277,7 +827,7 @@ void nsgtk_theme_implement(struct nsgtk_scaffolding *g)
 {
        struct nsgtk_theme *theme[IMAGE_SET_COUNT];
        int i;
-       struct nsgtk_button_connect *button;
+       struct nsgtk_toolbar_item *button;
        struct gtk_search *search;
 
        theme[IMAGE_SET_MAIN_MENU] = nsgtk_theme_load(GTK_ICON_SIZE_MENU, 
false);
@@ -387,7 +937,7 @@ static void nsgtk_toolbar_clear_toolbar(GtkWidget *widget, 
gpointer data)
 static void nsgtk_toolbar_temp_connect(struct nsgtk_scaffolding *g,
                                       nsgtk_toolbar_button bi)
 {
-       struct nsgtk_button_connect *bc;
+       struct nsgtk_toolbar_item *bc;
 
        if (bi != URL_BAR_ITEM) {
                bc = nsgtk_scaffolding_button(g, bi);
@@ -418,182 +968,6 @@ nsgtk_toolbar_get_id_at_location(struct nsgtk_scaffolding 
*g, int i)
        return -1;
 }
 
-/**
- * widget factory for creation of toolbar item widgets
- * \param g the reference scaffolding
- * \param i the id of the widget
- * \param theme the theme to make the widgets from
- */
-static GtkWidget *
-nsgtk_toolbar_make_widget(struct nsgtk_scaffolding *g,
-                         nsgtk_toolbar_button i,
-                         struct nsgtk_theme *theme)
-{
-       GtkWidget *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_WIDGET(gtk_tool_button_new(GTK_WIDGET(  \
-                                          theme->image[p##_BUTTON]), label)); \
-                       free(label);                                    \
-               } else {                                                \
-                       w = GTK_WIDGET(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
-
-       case HISTORY_BUTTON:
-               w = GTK_WIDGET(gtk_tool_button_new(GTK_WIDGET(
-                               theme->image[HISTORY_BUTTON]), "H"));
-               break;
-
-       case URL_BAR_ITEM: {
-               GtkWidget *entry = nsgtk_entry_new();
-               w = GTK_WIDGET(gtk_tool_item_new());
-
-               if ((entry == NULL) || (w == NULL)) {
-                       nsgtk_warning(messages_get("NoMemory"), 0);
-                       return NULL;
-               }
-
-               gtk_container_add(GTK_CONTAINER(w), entry);
-               gtk_tool_item_set_expand(GTK_TOOL_ITEM(w), TRUE);
-               break;
-       }
-
-       case THROBBER_ITEM: {
-               nserror res;
-               GdkPixbuf *pixbuf;
-               res = nsgtk_throbber_get_frame(0, &pixbuf);
-               if (res != NSERROR_OK) {
-                       return NULL;
-               }
-
-               if (edit_mode) {
-                       w = GTK_WIDGET(gtk_tool_button_new(
-                               GTK_WIDGET(gtk_image_new_from_pixbuf(pixbuf)),
-                               "[throbber]"));
-               } else {
-                       GtkWidget *image;
-
-                       w = GTK_WIDGET(gtk_tool_item_new());
-
-                       image = gtk_image_new_from_pixbuf(pixbuf);
-                       if (image != NULL) {
-                               nsgtk_widget_set_alignment(image,
-                                                          GTK_ALIGN_CENTER,
-                                                          GTK_ALIGN_CENTER);
-                               nsgtk_widget_set_margins(image, 3, 0);
-
-                               gtk_container_add(GTK_CONTAINER(w), image);
-                       }
-               }
-               break;
-       }
-
-       case WEBSEARCH_ITEM: {
-               if (edit_mode)
-                       return GTK_WIDGET(gtk_tool_button_new(GTK_WIDGET(
-                                       
nsgtk_image_new_from_stock(NSGTK_STOCK_FIND,
-                                       GTK_ICON_SIZE_LARGE_TOOLBAR)),
-                                       "[websearch]"));
-
-               GtkWidget *entry = nsgtk_entry_new();
-
-               w = GTK_WIDGET(gtk_tool_item_new());
-
-               if ((entry == NULL) || (w == NULL)) {
-                       nsgtk_warning(messages_get("NoMemory"), 0);
-                       return NULL;
-               }
-
-               gtk_widget_set_size_request(entry, NSGTK_WEBSEARCH_WIDTH, -1);
-
-               nsgtk_entry_set_icon_from_stock(entry, GTK_ENTRY_ICON_PRIMARY,
-                                               NSGTK_STOCK_INFO);
-
-               gtk_container_add(GTK_CONTAINER(w), entry);
-               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_WIDGET(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)
-#undef MAKE_MENUBUTTON
-
-       default:
-               break;
-
-       }
-       return w;
-}
 
 /**
  * called when a widget is dropped onto the toolbar
@@ -641,8 +1015,7 @@ nsgtk_toolbar_data(GtkWidget *widget,
                                location = -1;
        }
        nsgtk_scaffolding_button(g, window->currentbutton)->button =
-                       GTK_TOOL_ITEM(nsgtk_toolbar_make_widget(g,
-                       window->currentbutton, theme));
+                       GTK_TOOL_ITEM(make_toolbar_item(window->currentbutton, 
theme));
        free(theme);
        if (nsgtk_scaffolding_button(g, window->currentbutton)->button
                        == NULL) {
@@ -744,8 +1117,7 @@ nsgtk_toolbar_add_item_to_toolbar(struct nsgtk_scaffolding 
*g, int i,
        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(
-                                       nsgtk_toolbar_make_widget(g, q,
-                                       theme));
+                                       make_toolbar_item(q, theme));
                        gtk_toolbar_insert(nsgtk_scaffolding_toolbar(g),
                                        nsgtk_scaffolding_button(g, q)->button,
                                        i);
@@ -899,51 +1271,6 @@ static void nsgtk_toolbar_cast(struct nsgtk_scaffolding 
*g)
 }
 
 
-/**
- * load toolbar settings from file; file is a set of fields arranged as
- * [itemreference];[itemlocation]|[itemreference];[itemlocation]| etc
- */
-void nsgtk_toolbar_customization_load(struct nsgtk_scaffolding *g)
-{
-       int i, ii;
-       char *buffer;
-       char *buffer1, *subbuffer, *ptr = NULL, *pter = NULL;
-
-       /* default toolbar button order */
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               nsgtk_scaffolding_button(g, i)->location =
-               (i <= THROBBER_ITEM) ? i : -1;
-       }
-
-       /* ensure the option is actually set */
-       if (nsoption_charp(toolbar_order) == NULL) {
-               return;
-       }
-       buffer = strdup(nsoption_charp(toolbar_order));
-
-       i = BACK_BUTTON;
-       ii = BACK_BUTTON;
-       buffer1 = strtok_r(buffer, "|", &ptr);
-       while (buffer1 != NULL) {
-               subbuffer = strtok_r(buffer1, ";", &pter);
-               if (subbuffer != NULL) {
-                       i = atoi(subbuffer);
-                       subbuffer = strtok_r(NULL, ";", &pter);
-                       if (subbuffer != NULL) {
-                               ii = atoi(subbuffer);
-                               if ((i >= BACK_BUTTON) &&
-                                   (i < PLACEHOLDER_BUTTON) &&
-                                   (ii >= -1) &&
-                                   (ii < PLACEHOLDER_BUTTON)) {
-                                       nsgtk_scaffolding_button(g, 
i)->location = ii;
-                               }
-                       }
-               }
-               buffer1 = strtok_r(NULL, "|", &ptr);
-       }
-
-       free(buffer);
-}
 
 
 /**
@@ -1163,7 +1490,7 @@ static void nsgtk_toolbar_window_open(struct 
nsgtk_scaffolding *g)
                if (i == URL_BAR_ITEM)
                        continue;
                window->store_buttons[i] =
-                       nsgtk_toolbar_make_widget(g, i, theme);
+                       make_toolbar_item(i, theme);
                if (window->store_buttons[i] == NULL) {
                        nsgtk_warning(messages_get("NoMemory"), 0);
                        continue;
@@ -1333,6 +1660,15 @@ int nsgtk_toolbar_get_id_from_widget(GtkWidget *widget,
        return -1;
 }
 
+/* exported interface documented in gtk/scaffolding.h */
+void nsgtk_scaffolding_update_url_bar_ref(struct nsgtk_scaffolding *g)
+{
+       g->url_bar = GTK_WIDGET(gtk_bin_get_child(GTK_BIN(
+                       g->buttons[URL_BAR_ITEM]->button)));
+
+       gtk_entry_set_completion(GTK_ENTRY(g->url_bar),
+                       g->url_bar_completion);
+}
 
 /**
  * add handlers to factory widgets
@@ -1401,92 +1737,3 @@ void nsgtk_toolbar_connect_all(struct nsgtk_scaffolding 
*g)
 }
 
 
-#define DATAHANDLER(p, q, r)\
-gboolean nsgtk_toolbar_##p##_button_data(GtkWidget *widget, GdkDragContext\
-               *cont, GtkSelectionData *selection, guint info, guint time,\
-               gpointer data)\
-{\
-       r->currentbutton = q##_BUTTON;\
-       r->fromstore = true;\
-       return TRUE;\
-}\
-gboolean nsgtk_toolbar_##p##_toolbar_button_data(GtkWidget *widget,\
-               GdkDragContext *cont, GtkSelectionData *selection, guint info,\
-               guint time, gpointer data)\
-{\
-       r->currentbutton = q##_BUTTON;\
-       r->fromstore = false;\
-       return TRUE;\
-}
-
-DATAHANDLER(home, HOME, window)
-DATAHANDLER(forward, FORWARD, window)
-DATAHANDLER(back, BACK, window)
-DATAHANDLER(stop, STOP, window)
-DATAHANDLER(reload, RELOAD, window)
-DATAHANDLER(history, HISTORY, window)
-DATAHANDLER(newwindow, NEWWINDOW, window)
-DATAHANDLER(newtab, NEWTAB, window)
-DATAHANDLER(openfile, OPENFILE, window)
-DATAHANDLER(closetab, CLOSETAB, window)
-DATAHANDLER(closewindow, CLOSEWINDOW, window)
-DATAHANDLER(savepage, SAVEPAGE, window)
-DATAHANDLER(printpreview, PRINTPREVIEW, window)
-DATAHANDLER(print, PRINT, window)
-DATAHANDLER(quit, QUIT, window)
-DATAHANDLER(cut, CUT, window)
-DATAHANDLER(copy, COPY, window)
-DATAHANDLER(paste, PASTE, window)
-DATAHANDLER(delete, DELETE, window)
-DATAHANDLER(selectall, SELECTALL, window)
-DATAHANDLER(preferences, PREFERENCES, window)
-DATAHANDLER(zoomplus, ZOOMPLUS, window)
-DATAHANDLER(zoomminus, ZOOMMINUS, window)
-DATAHANDLER(zoomnormal, ZOOMNORMAL, window)
-DATAHANDLER(fullscreen, FULLSCREEN, window)
-DATAHANDLER(viewsource, VIEWSOURCE, window)
-DATAHANDLER(contents, CONTENTS, window)
-DATAHANDLER(about, ABOUT, window)
-DATAHANDLER(pdf, PDF, window)
-DATAHANDLER(plaintext, PLAINTEXT, window)
-DATAHANDLER(drawfile, DRAWFILE, window)
-DATAHANDLER(postscript, POSTSCRIPT, window)
-DATAHANDLER(find, FIND, window)
-DATAHANDLER(downloads, DOWNLOADS, window)
-DATAHANDLER(savewindowsize, SAVEWINDOWSIZE, window)
-DATAHANDLER(toggledebugging, TOGGLEDEBUGGING, window)
-DATAHANDLER(debugboxtree, SAVEBOXTREE, window)
-DATAHANDLER(debugdomtree, SAVEDOMTREE, window)
-DATAHANDLER(localhistory, LOCALHISTORY, window)
-DATAHANDLER(globalhistory, GLOBALHISTORY, window)
-DATAHANDLER(addbookmarks, ADDBOOKMARKS, window)
-DATAHANDLER(showbookmarks, SHOWBOOKMARKS, window)
-DATAHANDLER(showcookies, SHOWCOOKIES, window)
-DATAHANDLER(openlocation, OPENLOCATION, window)
-DATAHANDLER(nexttab, NEXTTAB, window)
-DATAHANDLER(prevtab, PREVTAB, window)
-DATAHANDLER(guide, GUIDE, window)
-DATAHANDLER(info, INFO, window)
-#undef DATAHANDLER
-
-#define DATAHANDLER(p, q, r)                                           \
-gboolean nsgtk_toolbar_##p##_button_data(GtkWidget *widget, GdkDragContext\
-               *cont, GtkSelectionData *selection, guint info, guint time,\
-               gpointer data)\
-{\
-       r->currentbutton = q##_ITEM;\
-       r->fromstore = true;\
-       return TRUE;\
-}\
-gboolean nsgtk_toolbar_##p##_toolbar_button_data(GtkWidget *widget,\
-               GdkDragContext *cont, GtkSelectionData *selection, guint info,\
-               guint time, gpointer data)\
-{\
-       r->currentbutton = q##_ITEM;\
-       r->fromstore = false;\
-       return TRUE;\
-}
-
-DATAHANDLER(throbber, THROBBER, window)
-DATAHANDLER(websearch, WEBSEARCH, window)
-#undef DATAHANDLER
diff --git a/frontends/gtk/toolbar.h b/frontends/gtk/toolbar.h
index 4286fe3..afce22e 100644
--- a/frontends/gtk/toolbar.h
+++ b/frontends/gtk/toolbar.h
@@ -16,8 +16,42 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _NETSURF_GTK_TOOLBAR_H_
-#define _NETSURF_GTK_TOOLBAR_H_
+#ifndef NETSURF_GTK_TOOLBAR_H_
+#define NETSURF_GTK_TOOLBAR_H_
+
+/**
+ * control toolbar context
+ */
+struct nsgtk_toolbar;
+
+
+/**
+ * create a control toolbar
+ *
+ * \param[in] builder The gtk builder object the toolbar is being created from
+ * \param[out] toolbar a pointer to receive the result.
+ * \return NSERROR_OK and toolbar updated on success else error code
+ */
+nserror nsgtk_toolbar_create(GtkBuilder *builder, struct nsgtk_toolbar 
**toolbar);
+
+
+/**
+ * Destroy toolbar previously created
+ *
+ * \param toolbar A toolbar returned from a creation
+ * \return NSERROR_OK on success
+ */
+nserror nsgtk_toolbar_destroy(struct nsgtk_toolbar *toolbar);
+
+
+/**
+ * Update toolbar style and size based on current settings
+ *
+ * \param toolbar A toolbar returned from a creation
+ * \return NSERROR_OK on success
+ */
+nserror nsgtk_toolbar_update(struct nsgtk_toolbar *tb);
+
 
 /**
  * sets up the images for scaffolding.
@@ -25,68 +59,8 @@
 void nsgtk_theme_implement(struct nsgtk_scaffolding *g);
 
 void nsgtk_toolbar_customization_init(struct nsgtk_scaffolding *g);
-void nsgtk_toolbar_init(struct nsgtk_scaffolding *g);
-void nsgtk_toolbar_customization_load(struct nsgtk_scaffolding *g);
-void nsgtk_toolbar_set_physical(struct nsgtk_scaffolding *g);
 void nsgtk_toolbar_connect_all(struct nsgtk_scaffolding *g);
 int nsgtk_toolbar_get_id_from_widget(GtkWidget *widget, struct 
nsgtk_scaffolding *g);
 
-#define TOOLPROTO(q) gboolean nsgtk_toolbar_##q##_button_data(\
-               GtkWidget *widget, GdkDragContext *cont, GtkSelectionData\
-               *selection, guint info, guint time, gpointer data);\
-gboolean nsgtk_toolbar_##q##_toolbar_button_data(GtkWidget *widget,\
-               GdkDragContext *cont, GtkSelectionData *selection, guint info,\
-               guint time, gpointer data)
-TOOLPROTO(home);
-TOOLPROTO(back);
-TOOLPROTO(forward);
-TOOLPROTO(reload);
-TOOLPROTO(stop);
-TOOLPROTO(throbber);
-TOOLPROTO(websearch);
-TOOLPROTO(history);
-TOOLPROTO(newwindow);
-TOOLPROTO(newtab);
-TOOLPROTO(openfile);
-TOOLPROTO(closetab);
-TOOLPROTO(closewindow);
-TOOLPROTO(savepage);
-TOOLPROTO(pdf);
-TOOLPROTO(plaintext);
-TOOLPROTO(drawfile);
-TOOLPROTO(postscript);
-TOOLPROTO(printpreview);
-TOOLPROTO(print);
-TOOLPROTO(quit);
-TOOLPROTO(cut);
-TOOLPROTO(copy);
-TOOLPROTO(paste);
-TOOLPROTO(delete);
-TOOLPROTO(selectall);
-TOOLPROTO(find);
-TOOLPROTO(preferences);
-TOOLPROTO(zoomplus);
-TOOLPROTO(zoomminus);
-TOOLPROTO(zoomnormal);
-TOOLPROTO(fullscreen);
-TOOLPROTO(viewsource);
-TOOLPROTO(downloads);
-TOOLPROTO(localhistory);
-TOOLPROTO(globalhistory);
-TOOLPROTO(addbookmarks);
-TOOLPROTO(showbookmarks);
-TOOLPROTO(showcookies);
-TOOLPROTO(openlocation);
-TOOLPROTO(nexttab);
-TOOLPROTO(prevtab);
-TOOLPROTO(savewindowsize);
-TOOLPROTO(toggledebugging);
-TOOLPROTO(debugboxtree);
-TOOLPROTO(debugdomtree);
-TOOLPROTO(contents);
-TOOLPROTO(guide);
-TOOLPROTO(info);
-TOOLPROTO(about);
-#undef TOOLPROTO
 
 #endif
diff --git a/frontends/gtk/toolbar_items.h b/frontends/gtk/toolbar_items.h
new file mode 100644
index 0000000..fd01103
--- /dev/null
+++ b/frontends/gtk/toolbar_items.h
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2012 Vincent Sanders <[email protected]>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NETSURF_GTK_TOOLBAR_ITEMS_H
+#define NETSURF_GTK_TOOLBAR_ITEMS_H
+
+typedef enum {
+       BACK_BUTTON = 0,
+       HISTORY_BUTTON,
+       FORWARD_BUTTON,
+       STOP_BUTTON,
+       RELOAD_BUTTON,
+       HOME_BUTTON,
+       URL_BAR_ITEM,
+       WEBSEARCH_ITEM,
+       THROBBER_ITEM,
+       NEWWINDOW_BUTTON,
+       NEWTAB_BUTTON,
+       OPENFILE_BUTTON,
+       CLOSETAB_BUTTON,
+       CLOSEWINDOW_BUTTON,
+       SAVEPAGE_BUTTON,
+       PDF_BUTTON,
+       PLAINTEXT_BUTTON,
+       DRAWFILE_BUTTON,
+       POSTSCRIPT_BUTTON,
+       PRINTPREVIEW_BUTTON,
+       PRINT_BUTTON,
+       QUIT_BUTTON,
+       CUT_BUTTON,
+       COPY_BUTTON,
+       PASTE_BUTTON,
+       DELETE_BUTTON,
+       SELECTALL_BUTTON,
+       FIND_BUTTON,
+       PREFERENCES_BUTTON,
+       ZOOMPLUS_BUTTON,
+       ZOOMMINUS_BUTTON,
+       ZOOMNORMAL_BUTTON,
+       FULLSCREEN_BUTTON,
+       VIEWSOURCE_BUTTON,
+       DOWNLOADS_BUTTON,
+       SAVEWINDOWSIZE_BUTTON,
+       TOGGLEDEBUGGING_BUTTON,
+       SAVEBOXTREE_BUTTON,
+       SAVEDOMTREE_BUTTON,
+       LOCALHISTORY_BUTTON,
+       GLOBALHISTORY_BUTTON,
+       ADDBOOKMARKS_BUTTON,
+       SHOWBOOKMARKS_BUTTON,
+       SHOWCOOKIES_BUTTON,
+       OPENLOCATION_BUTTON,
+       NEXTTAB_BUTTON,
+       PREVTAB_BUTTON,
+       CONTENTS_BUTTON,
+       GUIDE_BUTTON,
+       INFO_BUTTON,
+       ABOUT_BUTTON,
+       PLACEHOLDER_BUTTON /* size indicator; array maximum indices */
+} nsgtk_toolbar_button;    /* PLACEHOLDER_BUTTON - 1 */
+
+#endif
+
+/*
+ * Item fields are:
+ *   item identifier enum
+ *   item name
+ *   item initial visibility
+ */
+
+TOOLBAR_ITEM(BACK_BUTTON, back, false)
+TOOLBAR_ITEM(HISTORY_BUTTON, history, true)
+TOOLBAR_ITEM(FORWARD_BUTTON, forward, false)
+TOOLBAR_ITEM(STOP_BUTTON, stop, false)
+TOOLBAR_ITEM(RELOAD_BUTTON, reload, true)
+TOOLBAR_ITEM(HOME_BUTTON, home, true)
+TOOLBAR_ITEM(URL_BAR_ITEM, url_bar, true)
+TOOLBAR_ITEM(WEBSEARCH_ITEM, websearch, true)
+TOOLBAR_ITEM(THROBBER_ITEM, throbber, true)
+TOOLBAR_ITEM(NEWWINDOW_BUTTON, newwindow, true)
+TOOLBAR_ITEM(NEWTAB_BUTTON, newtab, true)
+TOOLBAR_ITEM(OPENFILE_BUTTON, openfile, true)
+TOOLBAR_ITEM(CLOSETAB_BUTTON, closetab, false)
+TOOLBAR_ITEM(CLOSEWINDOW_BUTTON, closewindow, true)
+TOOLBAR_ITEM(SAVEPAGE_BUTTON, savepage, true)
+TOOLBAR_ITEM(PDF_BUTTON, pdf, false)
+TOOLBAR_ITEM(PLAINTEXT_BUTTON, plaintext, true)
+TOOLBAR_ITEM(DRAWFILE_BUTTON, drawfile, false)
+TOOLBAR_ITEM(POSTSCRIPT_BUTTON, postscript, false)
+TOOLBAR_ITEM(PRINTPREVIEW_BUTTON, printpreview, false)
+TOOLBAR_ITEM(PRINT_BUTTON, print, true)
+TOOLBAR_ITEM(QUIT_BUTTON, quit, true)
+TOOLBAR_ITEM(CUT_BUTTON, cut, true)
+TOOLBAR_ITEM(COPY_BUTTON, copy, true)
+TOOLBAR_ITEM(PASTE_BUTTON, paste, true)
+TOOLBAR_ITEM(DELETE_BUTTON, delete, false)
+TOOLBAR_ITEM(SELECTALL_BUTTON, selectall, true)
+TOOLBAR_ITEM(FIND_BUTTON, find, true)
+TOOLBAR_ITEM(PREFERENCES_BUTTON, preferences, true)
+TOOLBAR_ITEM(ZOOMPLUS_BUTTON, zoomplus, true)
+TOOLBAR_ITEM(ZOOMMINUS_BUTTON, zoomminus, true)
+TOOLBAR_ITEM(ZOOMNORMAL_BUTTON, zoomnormal, true)
+TOOLBAR_ITEM(FULLSCREEN_BUTTON, fullscreen, true)
+TOOLBAR_ITEM(VIEWSOURCE_BUTTON, viewsource, true)
+TOOLBAR_ITEM(DOWNLOADS_BUTTON, downloads, true)
+TOOLBAR_ITEM(SAVEWINDOWSIZE_BUTTON, savewindowsize, true)
+TOOLBAR_ITEM(TOGGLEDEBUGGING_BUTTON, toggledebugging, true)
+TOOLBAR_ITEM(SAVEBOXTREE_BUTTON, debugboxtree, true)
+TOOLBAR_ITEM(SAVEDOMTREE_BUTTON, debugdomtree, true)
+TOOLBAR_ITEM(LOCALHISTORY_BUTTON, localhistory, true)
+TOOLBAR_ITEM(GLOBALHISTORY_BUTTON, globalhistory, true)
+TOOLBAR_ITEM(ADDBOOKMARKS_BUTTON, addbookmarks, true)
+TOOLBAR_ITEM(SHOWBOOKMARKS_BUTTON, showbookmarks, true)
+TOOLBAR_ITEM(SHOWCOOKIES_BUTTON, showcookies, true)
+TOOLBAR_ITEM(OPENLOCATION_BUTTON, openlocation, true)
+TOOLBAR_ITEM(NEXTTAB_BUTTON, nexttab, false)
+TOOLBAR_ITEM(PREVTAB_BUTTON, prevtab, false)
+TOOLBAR_ITEM(CONTENTS_BUTTON, contents, true)
+TOOLBAR_ITEM(GUIDE_BUTTON, guide, true)
+TOOLBAR_ITEM(INFO_BUTTON, info, true)
+TOOLBAR_ITEM(ABOUT_BUTTON, about, true)


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


-- 
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