Gitweb links:

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

The branch, vince/gtk-tab-restyle has been updated
       via  a01e6fa86685a5fd2976c594219b07cae56cb01a (commit)
       via  142bd733937613e0160fcbf2d517b655a3d939ab (commit)
      from  9e7d58ec30ee6cfbadc64a343573887a067d9711 (commit)

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

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

    fix toolbar customisation

diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index aed35e7..8eba867 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -524,14 +524,19 @@ make_toolbar_item(nsgtk_toolbar_button itemid, bool 
sensitivity)
  * \return gtk tool item widget
  */
 static GtkToolItem *
-make_toolbox_item(nsgtk_toolbar_button itemid)
+make_toolbox_item(nsgtk_toolbar_button itemid, bool bar)
 {
        GtkToolItem *toolitem = NULL;
 
        switch(itemid) {
 #define TOOLBAR_ITEM_y(identifier, label, iconame)
 #define TOOLBAR_ITEM_n(identifier, label, iconame)
-#define TOOLBAR_ITEM_t(identifier, label, iconame)
+#define TOOLBAR_ITEM_t(identifier, label, iconame)             \
+       case identifier:                                        \
+               if (bar) {                                              \
+                       toolitem = make_toolbar_item_button(#label, iconame, 
true, true); \
+               }                                                       \
+               break;
 #define TOOLBAR_ITEM_b(identifier, label, iconame)             \
        case identifier:                                        \
                toolitem = make_toolbar_item_button(#label, iconame, true, 
true); \
@@ -811,7 +816,7 @@ customisation_toolbar_drag_drop_cb(GtkWidget *widget,
        }
 
 
-       dragitem->button = make_toolbox_item(tbc->dragitem);
+       dragitem->button = make_toolbox_item(tbc->dragitem, true);
 
        if (dragitem->button == NULL) {
                nsgtk_warning("NoMemory", 0);
@@ -978,7 +983,8 @@ apply_user_button_customisation(struct nsgtk_toolbar *tb)
                }
 
                for (iidx = BACK_BUTTON; iidx < PLACEHOLDER_BUTTON; iidx++) {
-                       if (strncmp(tb->items[iidx].name, start, end - start) 
== 0) {
+                       if (((ssize_t)strlen(tb->items[iidx].name) == (end - 
start)) &&
+                           (strncmp(tb->items[iidx].name, start, end - start) 
== 0)) {
                                tb->items[iidx].location = location++;
                                break;
                        }
@@ -1038,12 +1044,12 @@ static nserror populate_gtk_toolbar_widget(struct 
nsgtk_toolbar *tb)
                if (itemid == PLACEHOLDER_BUTTON) {
                        break;
                }
-               tb->items[location].button =
-                       make_toolbar_item(location,
-                                         tb->items[location].sensitivity);
+               tb->items[itemid].button =
+                       make_toolbar_item(itemid,
+                                         tb->items[itemid].sensitivity);
 
                gtk_toolbar_insert(tb->widget,
-                                  tb->items[location].button,
+                                  tb->items[itemid].button,
                                   location);
        }
 
@@ -1075,10 +1081,10 @@ static nserror customisation_toolbar_populate(struct 
nsgtk_toolbar *tb)
                if (itemid == PLACEHOLDER_BUTTON) {
                        break;
                }
-               tb->items[location].button = make_toolbox_item(location);
+               tb->items[itemid].button = make_toolbox_item(itemid, true);
 
                gtk_toolbar_insert(tb->widget,
-                                  tb->items[location].button,
+                                  tb->items[itemid].button,
                                   location);
        }
 
@@ -1423,7 +1429,7 @@ toolbar_customisation_create_toolbox(struct 
nsgtk_toolbar_customisation *tbc,
                        curcol = 0;
                        startidx = iidx;
                }
-               tbc->items[iidx] = make_toolbox_item(iidx);
+               tbc->items[iidx] = make_toolbox_item(iidx, false);
                if (tbc->items[iidx] != NULL) {
                        curcol++;
                }


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

    persist the menu and tool bar visibility as user settings

diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index 21d146c..f14c7bd 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -251,7 +251,10 @@ static nserror set_defaults(struct nsoption_s *defaults)
 
        /* set default items in toolbar */
        nsoption_set_charp(toolbar_items,
-                          
strdup("back/history/forward/reloadstop/url_bar/websearch/openmenu"));
+         strdup("back/history/forward/reloadstop/url_bar/websearch/openmenu"));
+
+       /* set default for menu and tool bar visibility */
+       nsoption_set_charp(bar_show, strdup("tool"));
 
        return NSERROR_OK;
 }
diff --git a/frontends/gtk/options.h b/frontends/gtk/options.h
index 483a766..dad17f0 100644
--- a/frontends/gtk/options.h
+++ b/frontends/gtk/options.h
@@ -75,4 +75,4 @@ NSOPTION_INTEGER(position_tab, 0)
 NSOPTION_STRING(toolbar_items, NULL)
 
 /* The menu and tool bars that are shown */
-NSOPTION_STRING(toolbar_show, NULL)
+NSOPTION_STRING(bar_show, NULL)
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index 5a50d81..459195f 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -589,6 +589,55 @@ static gboolean nsgtk_on_find_activate_menu(GtkMenuItem 
*widget, gpointer data)
        return TRUE;
 }
 
+static nserror get_bar_show(bool *menu, bool *tool)
+{
+       const char *cur_bar_show;
+
+       *menu = false;
+       *tool = false;
+
+       cur_bar_show = nsoption_charp(bar_show);
+       if (cur_bar_show != NULL) {
+               if (strcmp(cur_bar_show, "menu/tool") == 0) {
+                       *menu = true;
+                       *tool = true;
+               } else if (strcmp(cur_bar_show, "menu") == 0) {
+                       *menu = true;
+               } else if (strcmp(cur_bar_show, "tool") == 0) {
+                       *tool = true;
+               }
+       }
+
+       return NSERROR_OK;
+}
+
+static nserror set_bar_show(const char *bar, bool show)
+{
+       bool menu;
+       bool tool;
+       const char *new_bar_show;
+
+       get_bar_show(&menu, &tool);
+
+       if (strcmp(bar, "menu") == 0) {
+               menu = show;
+       } else if (strcmp(bar, "tool") == 0) {
+               tool = show;
+       }
+
+       if ((menu == true) && (tool == true)) {
+               new_bar_show = "menu/tool";
+       } else if (menu == true) {
+               new_bar_show = "menu";
+       } else if (tool == true) {
+               new_bar_show = "tool";
+       } else {
+               new_bar_show = "none";
+       }
+       nsoption_set_charp(bar_show, strdup(new_bar_show));
+
+       return NSERROR_OK;
+}
 
 static gboolean
 nsgtk_on_menubar_activate_menu(GtkMenuItem *widget, gpointer data)
@@ -617,7 +666,7 @@ nsgtk_on_menubar_activate_menu(GtkMenuItem *widget, 
gpointer data)
                }
 
                gtk_widget_show(GTK_WIDGET(gs->menu_bar->bar_menu));
-
+               set_bar_show("menu", true);
        } else {
                if (gtk_check_menu_item_get_active(bmcmi) == TRUE) {
                        gtk_check_menu_item_set_active(bmcmi, FALSE);
@@ -632,6 +681,7 @@ nsgtk_on_menubar_activate_menu(GtkMenuItem *widget, 
gpointer data)
                }
 
                gtk_widget_hide(GTK_WIDGET(gs->menu_bar->bar_menu));
+               set_bar_show("menu", false);
        }
        return TRUE;
 }
@@ -664,6 +714,7 @@ nsgtk_on_toolbar_activate_menu(GtkMenuItem *widget, 
gpointer data)
                }
 
                nsgtk_window_toolbar_show(gs, true);
+               set_bar_show("tool", true);
        } else {
                if (gtk_check_menu_item_get_active(bmcmi) == TRUE) {
                        gtk_check_menu_item_set_active(bmcmi, FALSE);
@@ -678,6 +729,7 @@ nsgtk_on_toolbar_activate_menu(GtkMenuItem *widget, 
gpointer data)
                }
 
                nsgtk_window_toolbar_show(gs, false);
+               set_bar_show("tool", false);
        }
        return TRUE;
 }
@@ -792,6 +844,7 @@ create_scaffolding_burger_menu(struct nsgtk_scaffolding *gs,
        return nmenu;
 }
 
+
 /**
  * Create and connect handlers to popup menu.
  *
@@ -800,7 +853,8 @@ create_scaffolding_burger_menu(struct nsgtk_scaffolding *gs,
  * \return menu structure on success or NULL on error.
  */
 static struct nsgtk_popup_menu *
-create_scaffolding_popup_menu(struct nsgtk_scaffolding *gs, GtkAccelGroup 
*group)
+create_scaffolding_popup_menu(struct nsgtk_scaffolding *gs,
+                             GtkAccelGroup *group)
 {
        struct nsgtk_popup_menu *nmenu;
 
@@ -1013,6 +1067,7 @@ static void nsgtk_menu_set_sensitivity(struct 
nsgtk_scaffolding *g)
        }
 }
 
+
 /* set menu items to have icons */
 static void nsgtk_menu_set_icons(struct nsgtk_scaffolding *g)
 {
@@ -1041,6 +1096,7 @@ static void nsgtk_menu_set_icons(struct nsgtk_scaffolding 
*g)
        }
 }
 
+
 /**
  * create and initialise menus
  *
@@ -1103,10 +1159,6 @@ static nserror nsgtk_menus_create(struct 
nsgtk_scaffolding *gs)
 }
 
 
-
-
-
-
 /* exported function documented in gtk/scaffolding.h */
 void nsgtk_scaffolding_set_title(struct gui_window *gw, const char *title)
 {
@@ -1189,12 +1241,6 @@ GtkNotebook* nsgtk_scaffolding_notebook(struct 
nsgtk_scaffolding *g)
        return g->notebook;
 }
 
-/* exported interface documented in gtk/scaffolding.h */
-GtkWidget *nsgtk_scaffolding_urlbar(struct nsgtk_scaffolding *g)
-{
-       return NULL;//g->url_bar;
-}
-
 
 /* exported interface documented in gtk/scaffolding.h */
 GtkMenuBar *nsgtk_scaffolding_menu_bar(struct nsgtk_scaffolding *gs)
@@ -1373,6 +1419,8 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct 
gui_window *toplevel)
 {
        nserror res;
        struct nsgtk_scaffolding *gs;
+       bool menu;
+       bool tool;
 
        gs = calloc(1, sizeof(*gs));
        if (gs == NULL) {
@@ -1457,6 +1505,14 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct 
gui_window *toplevel)
        gs->prev = NULL;
        scaf_list = gs;
 
+       /* set menu and tool bar visibility */
+       get_bar_show(&menu, &tool);
+       if (menu) {
+               gtk_widget_show(GTK_WIDGET(gs->menu_bar->bar_menu));
+       } else {
+               gtk_widget_hide(GTK_WIDGET(gs->menu_bar->bar_menu));
+       }
+
        /* finally, show the window. */
        gtk_widget_show(GTK_WIDGET(gs->window));
 
diff --git a/frontends/gtk/scaffolding.h b/frontends/gtk/scaffolding.h
index c30c585..1fae003 100644
--- a/frontends/gtk/scaffolding.h
+++ b/frontends/gtk/scaffolding.h
@@ -79,12 +79,6 @@ GtkWindow *nsgtk_scaffolding_window(struct nsgtk_scaffolding 
*g);
  */
 GtkNotebook *nsgtk_scaffolding_notebook(struct nsgtk_scaffolding *g);
 
-/**
- * Get the gtk url bar from a scaffold.
- */
-GtkWidget *nsgtk_scaffolding_urlbar(struct nsgtk_scaffolding *g);
-
-
 struct gtk_search *nsgtk_scaffolding_search(struct nsgtk_scaffolding *g);
 
 GtkMenuBar *nsgtk_scaffolding_menu_bar(struct nsgtk_scaffolding *g);
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 243c0ce..aed35e7 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -3608,7 +3608,6 @@ nserror nsgtk_toolbar_show(struct nsgtk_toolbar *tb, bool 
show)
                gtk_widget_show(GTK_WIDGET(tb->widget));
        } else {
                gtk_widget_hide(GTK_WIDGET(tb->widget));
-
        }
        return NSERROR_OK;
 }
diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c
index da904ea..a5defcf 100644
--- a/frontends/gtk/window.c
+++ b/frontends/gtk/window.c
@@ -707,6 +707,22 @@ static struct browser_window *bw_from_gw(void *data)
 }
 
 
+static bool get_tool_bar_show(void)
+{
+       const char *cur_bar_show;
+
+       cur_bar_show = nsoption_charp(bar_show);
+       if (cur_bar_show != NULL) {
+               if (strcmp(cur_bar_show, "menu/tool") == 0) {
+                       return true;
+               } else if (strcmp(cur_bar_show, "tool") == 0) {
+                       return true;
+               }
+       }
+       return false;
+}
+
+
 /**
  * Create and open a gtk container (window or tab) for a browsing context.
  *
@@ -887,6 +903,9 @@ gui_window_create(struct browser_window *bw,
        /* initialy should not be visible */
        nsgtk_search_toggle_visibility(g->search);
 
+       /* set toolbar visibility from user option */
+       nsgtk_toolbar_show(g->toolbar, get_tool_bar_show());
+
        /* safe to drop the reference to the tab_builder as the container is
         * referenced by the notebook now.
         */


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

Summary of changes:
 frontends/gtk/gui.c         |    5 ++-
 frontends/gtk/options.h     |    2 +-
 frontends/gtk/scaffolding.c |   80 ++++++++++++++++++++++++++++++++++++-------
 frontends/gtk/scaffolding.h |    6 ----
 frontends/gtk/toolbar.c     |   29 +++++++++-------
 frontends/gtk/window.c      |   19 ++++++++++
 6 files changed, 109 insertions(+), 32 deletions(-)

diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index 21d146c..f14c7bd 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -251,7 +251,10 @@ static nserror set_defaults(struct nsoption_s *defaults)
 
        /* set default items in toolbar */
        nsoption_set_charp(toolbar_items,
-                          
strdup("back/history/forward/reloadstop/url_bar/websearch/openmenu"));
+         strdup("back/history/forward/reloadstop/url_bar/websearch/openmenu"));
+
+       /* set default for menu and tool bar visibility */
+       nsoption_set_charp(bar_show, strdup("tool"));
 
        return NSERROR_OK;
 }
diff --git a/frontends/gtk/options.h b/frontends/gtk/options.h
index 483a766..dad17f0 100644
--- a/frontends/gtk/options.h
+++ b/frontends/gtk/options.h
@@ -75,4 +75,4 @@ NSOPTION_INTEGER(position_tab, 0)
 NSOPTION_STRING(toolbar_items, NULL)
 
 /* The menu and tool bars that are shown */
-NSOPTION_STRING(toolbar_show, NULL)
+NSOPTION_STRING(bar_show, NULL)
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index 5a50d81..459195f 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -589,6 +589,55 @@ static gboolean nsgtk_on_find_activate_menu(GtkMenuItem 
*widget, gpointer data)
        return TRUE;
 }
 
+static nserror get_bar_show(bool *menu, bool *tool)
+{
+       const char *cur_bar_show;
+
+       *menu = false;
+       *tool = false;
+
+       cur_bar_show = nsoption_charp(bar_show);
+       if (cur_bar_show != NULL) {
+               if (strcmp(cur_bar_show, "menu/tool") == 0) {
+                       *menu = true;
+                       *tool = true;
+               } else if (strcmp(cur_bar_show, "menu") == 0) {
+                       *menu = true;
+               } else if (strcmp(cur_bar_show, "tool") == 0) {
+                       *tool = true;
+               }
+       }
+
+       return NSERROR_OK;
+}
+
+static nserror set_bar_show(const char *bar, bool show)
+{
+       bool menu;
+       bool tool;
+       const char *new_bar_show;
+
+       get_bar_show(&menu, &tool);
+
+       if (strcmp(bar, "menu") == 0) {
+               menu = show;
+       } else if (strcmp(bar, "tool") == 0) {
+               tool = show;
+       }
+
+       if ((menu == true) && (tool == true)) {
+               new_bar_show = "menu/tool";
+       } else if (menu == true) {
+               new_bar_show = "menu";
+       } else if (tool == true) {
+               new_bar_show = "tool";
+       } else {
+               new_bar_show = "none";
+       }
+       nsoption_set_charp(bar_show, strdup(new_bar_show));
+
+       return NSERROR_OK;
+}
 
 static gboolean
 nsgtk_on_menubar_activate_menu(GtkMenuItem *widget, gpointer data)
@@ -617,7 +666,7 @@ nsgtk_on_menubar_activate_menu(GtkMenuItem *widget, 
gpointer data)
                }
 
                gtk_widget_show(GTK_WIDGET(gs->menu_bar->bar_menu));
-
+               set_bar_show("menu", true);
        } else {
                if (gtk_check_menu_item_get_active(bmcmi) == TRUE) {
                        gtk_check_menu_item_set_active(bmcmi, FALSE);
@@ -632,6 +681,7 @@ nsgtk_on_menubar_activate_menu(GtkMenuItem *widget, 
gpointer data)
                }
 
                gtk_widget_hide(GTK_WIDGET(gs->menu_bar->bar_menu));
+               set_bar_show("menu", false);
        }
        return TRUE;
 }
@@ -664,6 +714,7 @@ nsgtk_on_toolbar_activate_menu(GtkMenuItem *widget, 
gpointer data)
                }
 
                nsgtk_window_toolbar_show(gs, true);
+               set_bar_show("tool", true);
        } else {
                if (gtk_check_menu_item_get_active(bmcmi) == TRUE) {
                        gtk_check_menu_item_set_active(bmcmi, FALSE);
@@ -678,6 +729,7 @@ nsgtk_on_toolbar_activate_menu(GtkMenuItem *widget, 
gpointer data)
                }
 
                nsgtk_window_toolbar_show(gs, false);
+               set_bar_show("tool", false);
        }
        return TRUE;
 }
@@ -792,6 +844,7 @@ create_scaffolding_burger_menu(struct nsgtk_scaffolding *gs,
        return nmenu;
 }
 
+
 /**
  * Create and connect handlers to popup menu.
  *
@@ -800,7 +853,8 @@ create_scaffolding_burger_menu(struct nsgtk_scaffolding *gs,
  * \return menu structure on success or NULL on error.
  */
 static struct nsgtk_popup_menu *
-create_scaffolding_popup_menu(struct nsgtk_scaffolding *gs, GtkAccelGroup 
*group)
+create_scaffolding_popup_menu(struct nsgtk_scaffolding *gs,
+                             GtkAccelGroup *group)
 {
        struct nsgtk_popup_menu *nmenu;
 
@@ -1013,6 +1067,7 @@ static void nsgtk_menu_set_sensitivity(struct 
nsgtk_scaffolding *g)
        }
 }
 
+
 /* set menu items to have icons */
 static void nsgtk_menu_set_icons(struct nsgtk_scaffolding *g)
 {
@@ -1041,6 +1096,7 @@ static void nsgtk_menu_set_icons(struct nsgtk_scaffolding 
*g)
        }
 }
 
+
 /**
  * create and initialise menus
  *
@@ -1103,10 +1159,6 @@ static nserror nsgtk_menus_create(struct 
nsgtk_scaffolding *gs)
 }
 
 
-
-
-
-
 /* exported function documented in gtk/scaffolding.h */
 void nsgtk_scaffolding_set_title(struct gui_window *gw, const char *title)
 {
@@ -1189,12 +1241,6 @@ GtkNotebook* nsgtk_scaffolding_notebook(struct 
nsgtk_scaffolding *g)
        return g->notebook;
 }
 
-/* exported interface documented in gtk/scaffolding.h */
-GtkWidget *nsgtk_scaffolding_urlbar(struct nsgtk_scaffolding *g)
-{
-       return NULL;//g->url_bar;
-}
-
 
 /* exported interface documented in gtk/scaffolding.h */
 GtkMenuBar *nsgtk_scaffolding_menu_bar(struct nsgtk_scaffolding *gs)
@@ -1373,6 +1419,8 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct 
gui_window *toplevel)
 {
        nserror res;
        struct nsgtk_scaffolding *gs;
+       bool menu;
+       bool tool;
 
        gs = calloc(1, sizeof(*gs));
        if (gs == NULL) {
@@ -1457,6 +1505,14 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct 
gui_window *toplevel)
        gs->prev = NULL;
        scaf_list = gs;
 
+       /* set menu and tool bar visibility */
+       get_bar_show(&menu, &tool);
+       if (menu) {
+               gtk_widget_show(GTK_WIDGET(gs->menu_bar->bar_menu));
+       } else {
+               gtk_widget_hide(GTK_WIDGET(gs->menu_bar->bar_menu));
+       }
+
        /* finally, show the window. */
        gtk_widget_show(GTK_WIDGET(gs->window));
 
diff --git a/frontends/gtk/scaffolding.h b/frontends/gtk/scaffolding.h
index c30c585..1fae003 100644
--- a/frontends/gtk/scaffolding.h
+++ b/frontends/gtk/scaffolding.h
@@ -79,12 +79,6 @@ GtkWindow *nsgtk_scaffolding_window(struct nsgtk_scaffolding 
*g);
  */
 GtkNotebook *nsgtk_scaffolding_notebook(struct nsgtk_scaffolding *g);
 
-/**
- * Get the gtk url bar from a scaffold.
- */
-GtkWidget *nsgtk_scaffolding_urlbar(struct nsgtk_scaffolding *g);
-
-
 struct gtk_search *nsgtk_scaffolding_search(struct nsgtk_scaffolding *g);
 
 GtkMenuBar *nsgtk_scaffolding_menu_bar(struct nsgtk_scaffolding *g);
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 243c0ce..8eba867 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -524,14 +524,19 @@ make_toolbar_item(nsgtk_toolbar_button itemid, bool 
sensitivity)
  * \return gtk tool item widget
  */
 static GtkToolItem *
-make_toolbox_item(nsgtk_toolbar_button itemid)
+make_toolbox_item(nsgtk_toolbar_button itemid, bool bar)
 {
        GtkToolItem *toolitem = NULL;
 
        switch(itemid) {
 #define TOOLBAR_ITEM_y(identifier, label, iconame)
 #define TOOLBAR_ITEM_n(identifier, label, iconame)
-#define TOOLBAR_ITEM_t(identifier, label, iconame)
+#define TOOLBAR_ITEM_t(identifier, label, iconame)             \
+       case identifier:                                        \
+               if (bar) {                                              \
+                       toolitem = make_toolbar_item_button(#label, iconame, 
true, true); \
+               }                                                       \
+               break;
 #define TOOLBAR_ITEM_b(identifier, label, iconame)             \
        case identifier:                                        \
                toolitem = make_toolbar_item_button(#label, iconame, true, 
true); \
@@ -811,7 +816,7 @@ customisation_toolbar_drag_drop_cb(GtkWidget *widget,
        }
 
 
-       dragitem->button = make_toolbox_item(tbc->dragitem);
+       dragitem->button = make_toolbox_item(tbc->dragitem, true);
 
        if (dragitem->button == NULL) {
                nsgtk_warning("NoMemory", 0);
@@ -978,7 +983,8 @@ apply_user_button_customisation(struct nsgtk_toolbar *tb)
                }
 
                for (iidx = BACK_BUTTON; iidx < PLACEHOLDER_BUTTON; iidx++) {
-                       if (strncmp(tb->items[iidx].name, start, end - start) 
== 0) {
+                       if (((ssize_t)strlen(tb->items[iidx].name) == (end - 
start)) &&
+                           (strncmp(tb->items[iidx].name, start, end - start) 
== 0)) {
                                tb->items[iidx].location = location++;
                                break;
                        }
@@ -1038,12 +1044,12 @@ static nserror populate_gtk_toolbar_widget(struct 
nsgtk_toolbar *tb)
                if (itemid == PLACEHOLDER_BUTTON) {
                        break;
                }
-               tb->items[location].button =
-                       make_toolbar_item(location,
-                                         tb->items[location].sensitivity);
+               tb->items[itemid].button =
+                       make_toolbar_item(itemid,
+                                         tb->items[itemid].sensitivity);
 
                gtk_toolbar_insert(tb->widget,
-                                  tb->items[location].button,
+                                  tb->items[itemid].button,
                                   location);
        }
 
@@ -1075,10 +1081,10 @@ static nserror customisation_toolbar_populate(struct 
nsgtk_toolbar *tb)
                if (itemid == PLACEHOLDER_BUTTON) {
                        break;
                }
-               tb->items[location].button = make_toolbox_item(location);
+               tb->items[itemid].button = make_toolbox_item(itemid, true);
 
                gtk_toolbar_insert(tb->widget,
-                                  tb->items[location].button,
+                                  tb->items[itemid].button,
                                   location);
        }
 
@@ -1423,7 +1429,7 @@ toolbar_customisation_create_toolbox(struct 
nsgtk_toolbar_customisation *tbc,
                        curcol = 0;
                        startidx = iidx;
                }
-               tbc->items[iidx] = make_toolbox_item(iidx);
+               tbc->items[iidx] = make_toolbox_item(iidx, false);
                if (tbc->items[iidx] != NULL) {
                        curcol++;
                }
@@ -3608,7 +3614,6 @@ nserror nsgtk_toolbar_show(struct nsgtk_toolbar *tb, bool 
show)
                gtk_widget_show(GTK_WIDGET(tb->widget));
        } else {
                gtk_widget_hide(GTK_WIDGET(tb->widget));
-
        }
        return NSERROR_OK;
 }
diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c
index da904ea..a5defcf 100644
--- a/frontends/gtk/window.c
+++ b/frontends/gtk/window.c
@@ -707,6 +707,22 @@ static struct browser_window *bw_from_gw(void *data)
 }
 
 
+static bool get_tool_bar_show(void)
+{
+       const char *cur_bar_show;
+
+       cur_bar_show = nsoption_charp(bar_show);
+       if (cur_bar_show != NULL) {
+               if (strcmp(cur_bar_show, "menu/tool") == 0) {
+                       return true;
+               } else if (strcmp(cur_bar_show, "tool") == 0) {
+                       return true;
+               }
+       }
+       return false;
+}
+
+
 /**
  * Create and open a gtk container (window or tab) for a browsing context.
  *
@@ -887,6 +903,9 @@ gui_window_create(struct browser_window *bw,
        /* initialy should not be visible */
        nsgtk_search_toggle_visibility(g->search);
 
+       /* set toolbar visibility from user option */
+       nsgtk_toolbar_show(g->toolbar, get_tool_bar_show());
+
        /* safe to drop the reference to the tab_builder as the container is
         * referenced by the notebook now.
         */


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