Gitweb links:

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

The branch, master has been updated
       via  51f8e7c6a4d613ea15508f179a3b80f57deade59 (commit)
       via  5061687867ee9ae90b23469d7d6ac7f4c9c8424c (commit)
      from  a47a6dd52e92e75ebf11e125563fb953dd1cab8b (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=51f8e7c6a4d613ea15508f179a3b80f57deade59
commit 51f8e7c6a4d613ea15508f179a3b80f57deade59
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    fix test target

diff --git a/test/Makefile b/test/Makefile
index ca6d692..95e7132 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -80,7 +80,7 @@ TESTCFLAGS := -std=c99 -g -Wall \
                -D_BSD_SOURCE \
                -D_POSIX_C_SOURCE=200809L \
                -D_XOPEN_SOURCE=600 \
-               -Itest -I. -I.. \
+               -Itest -Ifrontends -I. -I.. \
                -Dnsgtk \
                $(shell pkg-config --cflags libcurl libparserutils libwapcaplet 
libdom libnsutils libutf8proc libidn) \
                $(LIB_CFLAGS) \


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

    store toolbar config in standard options instead of a separate file

diff --git a/.gitignore b/.gitignore
index 89ecd0d..3b674ff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
 \!NetSurf/Resources/nl/Messages
 \!NetSurf/Resources/it/Messages
 frontends/windows/res/preferences
-frontends/gtk/res/toolbarIndices
 frontends/gtk/res/en/Messages
 frontends/gtk/res/fr/Messages
 frontends/gtk/res/de/Messages
diff --git a/Makefile b/Makefile
index c8cf35e..4af0a03 100644
--- a/Makefile
+++ b/Makefile
@@ -672,9 +672,6 @@ endif
 ifeq ($(TARGET),windows)
        $(Q)$(TOUCH) frontends/windows/res/preferences
 endif
-ifeq ($(TARGET),gtk)
-       $(Q)$(TOUCH) frontends/gtk/res/toolbarIndices
-endif
 ifeq ($(NETSURF_STRIP_BINARY),YES)
        $(VQ)echo "   STRIP: $(EXETARGET)"
        $(Q)$(STRIP) $(EXETARGET)
diff --git a/frontends/gtk/Makefile b/frontends/gtk/Makefile
index 7f8ffc1..aae1d44 100644
--- a/frontends/gtk/Makefile
+++ b/frontends/gtk/Makefile
@@ -175,7 +175,7 @@ SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_RESOURCE) 
$(S_FRONTEND)
 # ----------------------------------------------------------------------------
 
 GTK_RESOURCES_LIST := \
-       languages SearchEngines toolbarIndices ca-bundle.txt \
+       languages SearchEngines ca-bundle.txt \
        default.css adblock.css quirks.css internal.css \
        credits.html licence.html welcome.html maps.html Messages \
        default.ico favicon.png netsurf.png netsurf.xpm netsurf-16x16.xpm \
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index e705918..60c8e79 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -74,8 +74,6 @@
 
 bool nsgtk_complete = false;
 
-char *toolbar_indices_file_location;
-
 char *nsgtk_config_home; /* exported global defined in gtk/gui.h */
 
 GdkPixbuf *favicon_pixbuf; /** favicon default pixbuf */
@@ -276,12 +274,6 @@ static nserror nsgtk_init(int argc, char** argv, char 
**respath)
                                                   false, 8, 8, 32);
        }
 
-       /* Toolbar inicies file */
-       toolbar_indices_file_location = filepath_find(respath,
-                                                     "toolbarIndices");
-       LOG("Using '%s' as custom toolbar settings file",
-           toolbar_indices_file_location);
-
        /* initialise throbber */
        error = nsgtk_throbber_init();
        if (error != NSERROR_OK) {
@@ -457,8 +449,6 @@ static void gui_quit(void)
        nsgtk_history_destroy();
        nsgtk_hotlist_destroy();
 
-       free(toolbar_indices_file_location);
-
        free(nsgtk_config_home);
 
        gtk_fetch_filetype_fin();
diff --git a/frontends/gtk/gui.h b/frontends/gtk/gui.h
index b6a6dc9..53e7324 100644
--- a/frontends/gtk/gui.h
+++ b/frontends/gtk/gui.h
@@ -21,9 +21,6 @@
 
 struct nsurl;
 
-/** toolbar arrangement file path. */
-extern char *toolbar_indices_file_location;
-
 /** Directory where all configuration files are held. */
 extern char *nsgtk_config_home;
 
diff --git a/frontends/gtk/options.h b/frontends/gtk/options.h
index ac642c1..018a448 100644
--- a/frontends/gtk/options.h
+++ b/frontends/gtk/options.h
@@ -70,3 +70,6 @@ NSOPTION_INTEGER(developer_view, 0)
 
 /* where tabs are positioned */
 NSOPTION_INTEGER(position_tab, 0)
+
+/* Toolbar customisation */
+NSOPTION_STRING(toolbar_order, NULL)
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 208b5c0..1def9dc 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -26,10 +26,10 @@
 #include "utils/log.h"
 #include "utils/messages.h"
 #include "utils/utils.h"
+#include "utils/nsoption.h"
 
 #include "gtk/gui.h"
 #include "gtk/warn.h"
-#include "gtk/scaffolding.h"
 #include "gtk/search.h"
 #include "gtk/throbber.h"
 #include "gtk/window.h"
@@ -833,22 +833,6 @@ static bool nsgtk_toolbar_add_store_widget(GtkWidget 
*widget)
        return true;
 }
 
-/**
- * save toolbar settings to file
- */
-static void nsgtk_toolbar_customization_save(struct nsgtk_scaffolding *g)
-{
-       int i;
-       FILE *f = fopen(toolbar_indices_file_location, "w");
-       if (f == NULL){
-               nsgtk_warning("gtkFileError", toolbar_indices_file_location);
-               return;
-       }
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               fprintf(f, "%d;%d|", i, nsgtk_scaffolding_button(g, 
i)->location);
-       }
-       fclose(f);
-}
 
 /**
  * cast toolbar settings to all scaffoldings referenced from the global linked
@@ -878,6 +862,93 @@ 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);
+}
+
+
+/**
+ * save toolbar settings to file
+ */
+static nserror nsgtk_toolbar_customization_save(struct nsgtk_scaffolding *g)
+{
+       char *order;
+       int order_len = PLACEHOLDER_BUTTON * 12; /* length of order buffer */
+       int tbidx;
+       char *cur;
+       int plen;
+
+       order = malloc(order_len);
+
+       if (order == NULL) {
+               return NSERROR_NOMEM;
+       }
+       cur = order;
+
+       for (tbidx = BACK_BUTTON; tbidx < PLACEHOLDER_BUTTON; tbidx++) {
+               plen = snprintf(cur,
+                               order_len,
+                               "%d;%d|",
+                               tbidx,
+                               nsgtk_scaffolding_button(g, tbidx)->location);
+               if (plen == order_len) {
+                       /* ran out of space, bail early */
+                       LOG("toolbar ordering exceeded available space");
+                       break;
+               }
+               cur += plen;
+               order_len -= plen;
+       }
+
+       nsoption_set_charp(toolbar_order, order);
+
+       return NSERROR_OK;
+}
+
+
 /**
  * when 'save settings' button is clicked
  */
@@ -1187,8 +1258,9 @@ void nsgtk_toolbar_customization_init(struct 
nsgtk_scaffolding *g)
 void nsgtk_toolbar_set_physical(struct nsgtk_scaffolding *g)
 {
        int i;
-       struct nsgtk_theme *theme =
-                       nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR);
+       struct nsgtk_theme *theme;
+
+       theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR);
        if (theme == NULL) {
                nsgtk_warning(messages_get("NoMemory"), 0);
                return;
@@ -1196,8 +1268,9 @@ void nsgtk_toolbar_set_physical(struct nsgtk_scaffolding 
*g)
        /* 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++)
+       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);
 }
@@ -1374,43 +1447,3 @@ DATAHANDLER(websearch, WEBSEARCH, window)
 #undef DATAHANDLER
 
 
-/**
- * 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 *val;
-       char buffer[SLEN("11;|") * 2 * PLACEHOLDER_BUTTON]; /* numbers 0-99 */
-       buffer[0] = '\0';
-       char *buffer1, *subbuffer, *ptr = NULL, *pter = NULL;
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++)
-               nsgtk_scaffolding_button(g, i)->location =
-               (i <= THROBBER_ITEM) ? i : -1;
-       FILE *f = fopen(toolbar_indices_file_location, "r");
-       if (f == NULL) {
-               nsgtk_warning(messages_get("gtkFileError"),
-                               toolbar_indices_file_location);
-               return;
-       }
-       val = fgets(buffer, sizeof buffer, f);
-       if (val == NULL) {
-               LOG("empty read toolbar settings");
-       }
-       fclose(f);
-       i = BACK_BUTTON;
-       ii = BACK_BUTTON;
-       buffer1 = strtok_r(buffer, "|", &ptr);
-       while (buffer1 != NULL) {
-               subbuffer = strtok_r(buffer1, ";", &pter);
-               i = atoi(subbuffer);
-               subbuffer = strtok_r(NULL, ";", &pter);
-               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);
-       }
-}
diff --git a/utils/nsoption.c b/utils/nsoption.c
index 387d7c7..7e77666 100644
--- a/utils/nsoption.c
+++ b/utils/nsoption.c
@@ -38,6 +38,9 @@
 #include "utils/utils.h"
 #include "utils/nsoption.h"
 
+/** Length of buffer used to read lines from input file */
+#define NSOPTION_MAX_LINE_LEN 1024
+
 struct nsoption_s *nsoptions = NULL;
 struct nsoption_s *nsoptions_default = NULL;
 
@@ -597,11 +600,12 @@ nserror nsoption_finalise(struct nsoption_s *opts, struct 
nsoption_s *defs)
        return NSERROR_OK;
 }
 
+
 /* exported interface documented in utils/nsoption.h */
 nserror
 nsoption_read(const char *path, struct nsoption_s *opts)
 {
-       char s[100];
+       char s[NSOPTION_MAX_LINE_LEN];
        FILE *fp;
        struct nsoption_s *defs;
 
@@ -625,7 +629,7 @@ nsoption_read(const char *path, struct nsoption_s *opts)
 
        LOG("Successfully opened '%s' for Options file", path);
 
-       while (fgets(s, 100, fp)) {
+       while (fgets(s, NSOPTION_MAX_LINE_LEN, fp)) {
                char *colon, *value;
                unsigned int idx;
 


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

Summary of changes:
 .gitignore              |    1 -
 Makefile                |    3 -
 frontends/gtk/Makefile  |    2 +-
 frontends/gtk/gui.c     |   10 ----
 frontends/gtk/gui.h     |    3 -
 frontends/gtk/options.h |    3 +
 frontends/gtk/toolbar.c |  153 ++++++++++++++++++++++++++++-------------------
 test/Makefile           |    2 +-
 utils/nsoption.c        |    8 ++-
 9 files changed, 104 insertions(+), 81 deletions(-)

diff --git a/.gitignore b/.gitignore
index 89ecd0d..3b674ff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
 \!NetSurf/Resources/nl/Messages
 \!NetSurf/Resources/it/Messages
 frontends/windows/res/preferences
-frontends/gtk/res/toolbarIndices
 frontends/gtk/res/en/Messages
 frontends/gtk/res/fr/Messages
 frontends/gtk/res/de/Messages
diff --git a/Makefile b/Makefile
index c8cf35e..4af0a03 100644
--- a/Makefile
+++ b/Makefile
@@ -672,9 +672,6 @@ endif
 ifeq ($(TARGET),windows)
        $(Q)$(TOUCH) frontends/windows/res/preferences
 endif
-ifeq ($(TARGET),gtk)
-       $(Q)$(TOUCH) frontends/gtk/res/toolbarIndices
-endif
 ifeq ($(NETSURF_STRIP_BINARY),YES)
        $(VQ)echo "   STRIP: $(EXETARGET)"
        $(Q)$(STRIP) $(EXETARGET)
diff --git a/frontends/gtk/Makefile b/frontends/gtk/Makefile
index 7f8ffc1..aae1d44 100644
--- a/frontends/gtk/Makefile
+++ b/frontends/gtk/Makefile
@@ -175,7 +175,7 @@ SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_RESOURCE) 
$(S_FRONTEND)
 # ----------------------------------------------------------------------------
 
 GTK_RESOURCES_LIST := \
-       languages SearchEngines toolbarIndices ca-bundle.txt \
+       languages SearchEngines ca-bundle.txt \
        default.css adblock.css quirks.css internal.css \
        credits.html licence.html welcome.html maps.html Messages \
        default.ico favicon.png netsurf.png netsurf.xpm netsurf-16x16.xpm \
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index e705918..60c8e79 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -74,8 +74,6 @@
 
 bool nsgtk_complete = false;
 
-char *toolbar_indices_file_location;
-
 char *nsgtk_config_home; /* exported global defined in gtk/gui.h */
 
 GdkPixbuf *favicon_pixbuf; /** favicon default pixbuf */
@@ -276,12 +274,6 @@ static nserror nsgtk_init(int argc, char** argv, char 
**respath)
                                                   false, 8, 8, 32);
        }
 
-       /* Toolbar inicies file */
-       toolbar_indices_file_location = filepath_find(respath,
-                                                     "toolbarIndices");
-       LOG("Using '%s' as custom toolbar settings file",
-           toolbar_indices_file_location);
-
        /* initialise throbber */
        error = nsgtk_throbber_init();
        if (error != NSERROR_OK) {
@@ -457,8 +449,6 @@ static void gui_quit(void)
        nsgtk_history_destroy();
        nsgtk_hotlist_destroy();
 
-       free(toolbar_indices_file_location);
-
        free(nsgtk_config_home);
 
        gtk_fetch_filetype_fin();
diff --git a/frontends/gtk/gui.h b/frontends/gtk/gui.h
index b6a6dc9..53e7324 100644
--- a/frontends/gtk/gui.h
+++ b/frontends/gtk/gui.h
@@ -21,9 +21,6 @@
 
 struct nsurl;
 
-/** toolbar arrangement file path. */
-extern char *toolbar_indices_file_location;
-
 /** Directory where all configuration files are held. */
 extern char *nsgtk_config_home;
 
diff --git a/frontends/gtk/options.h b/frontends/gtk/options.h
index ac642c1..018a448 100644
--- a/frontends/gtk/options.h
+++ b/frontends/gtk/options.h
@@ -70,3 +70,6 @@ NSOPTION_INTEGER(developer_view, 0)
 
 /* where tabs are positioned */
 NSOPTION_INTEGER(position_tab, 0)
+
+/* Toolbar customisation */
+NSOPTION_STRING(toolbar_order, NULL)
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 208b5c0..1def9dc 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -26,10 +26,10 @@
 #include "utils/log.h"
 #include "utils/messages.h"
 #include "utils/utils.h"
+#include "utils/nsoption.h"
 
 #include "gtk/gui.h"
 #include "gtk/warn.h"
-#include "gtk/scaffolding.h"
 #include "gtk/search.h"
 #include "gtk/throbber.h"
 #include "gtk/window.h"
@@ -833,22 +833,6 @@ static bool nsgtk_toolbar_add_store_widget(GtkWidget 
*widget)
        return true;
 }
 
-/**
- * save toolbar settings to file
- */
-static void nsgtk_toolbar_customization_save(struct nsgtk_scaffolding *g)
-{
-       int i;
-       FILE *f = fopen(toolbar_indices_file_location, "w");
-       if (f == NULL){
-               nsgtk_warning("gtkFileError", toolbar_indices_file_location);
-               return;
-       }
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
-               fprintf(f, "%d;%d|", i, nsgtk_scaffolding_button(g, 
i)->location);
-       }
-       fclose(f);
-}
 
 /**
  * cast toolbar settings to all scaffoldings referenced from the global linked
@@ -878,6 +862,93 @@ 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);
+}
+
+
+/**
+ * save toolbar settings to file
+ */
+static nserror nsgtk_toolbar_customization_save(struct nsgtk_scaffolding *g)
+{
+       char *order;
+       int order_len = PLACEHOLDER_BUTTON * 12; /* length of order buffer */
+       int tbidx;
+       char *cur;
+       int plen;
+
+       order = malloc(order_len);
+
+       if (order == NULL) {
+               return NSERROR_NOMEM;
+       }
+       cur = order;
+
+       for (tbidx = BACK_BUTTON; tbidx < PLACEHOLDER_BUTTON; tbidx++) {
+               plen = snprintf(cur,
+                               order_len,
+                               "%d;%d|",
+                               tbidx,
+                               nsgtk_scaffolding_button(g, tbidx)->location);
+               if (plen == order_len) {
+                       /* ran out of space, bail early */
+                       LOG("toolbar ordering exceeded available space");
+                       break;
+               }
+               cur += plen;
+               order_len -= plen;
+       }
+
+       nsoption_set_charp(toolbar_order, order);
+
+       return NSERROR_OK;
+}
+
+
 /**
  * when 'save settings' button is clicked
  */
@@ -1187,8 +1258,9 @@ void nsgtk_toolbar_customization_init(struct 
nsgtk_scaffolding *g)
 void nsgtk_toolbar_set_physical(struct nsgtk_scaffolding *g)
 {
        int i;
-       struct nsgtk_theme *theme =
-                       nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR);
+       struct nsgtk_theme *theme;
+
+       theme = nsgtk_theme_load(GTK_ICON_SIZE_LARGE_TOOLBAR);
        if (theme == NULL) {
                nsgtk_warning(messages_get("NoMemory"), 0);
                return;
@@ -1196,8 +1268,9 @@ void nsgtk_toolbar_set_physical(struct nsgtk_scaffolding 
*g)
        /* 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++)
+       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);
 }
@@ -1374,43 +1447,3 @@ DATAHANDLER(websearch, WEBSEARCH, window)
 #undef DATAHANDLER
 
 
-/**
- * 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 *val;
-       char buffer[SLEN("11;|") * 2 * PLACEHOLDER_BUTTON]; /* numbers 0-99 */
-       buffer[0] = '\0';
-       char *buffer1, *subbuffer, *ptr = NULL, *pter = NULL;
-       for (i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++)
-               nsgtk_scaffolding_button(g, i)->location =
-               (i <= THROBBER_ITEM) ? i : -1;
-       FILE *f = fopen(toolbar_indices_file_location, "r");
-       if (f == NULL) {
-               nsgtk_warning(messages_get("gtkFileError"),
-                               toolbar_indices_file_location);
-               return;
-       }
-       val = fgets(buffer, sizeof buffer, f);
-       if (val == NULL) {
-               LOG("empty read toolbar settings");
-       }
-       fclose(f);
-       i = BACK_BUTTON;
-       ii = BACK_BUTTON;
-       buffer1 = strtok_r(buffer, "|", &ptr);
-       while (buffer1 != NULL) {
-               subbuffer = strtok_r(buffer1, ";", &pter);
-               i = atoi(subbuffer);
-               subbuffer = strtok_r(NULL, ";", &pter);
-               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);
-       }
-}
diff --git a/test/Makefile b/test/Makefile
index ca6d692..95e7132 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -80,7 +80,7 @@ TESTCFLAGS := -std=c99 -g -Wall \
                -D_BSD_SOURCE \
                -D_POSIX_C_SOURCE=200809L \
                -D_XOPEN_SOURCE=600 \
-               -Itest -I. -I.. \
+               -Itest -Ifrontends -I. -I.. \
                -Dnsgtk \
                $(shell pkg-config --cflags libcurl libparserutils libwapcaplet 
libdom libnsutils libutf8proc libidn) \
                $(LIB_CFLAGS) \
diff --git a/utils/nsoption.c b/utils/nsoption.c
index 387d7c7..7e77666 100644
--- a/utils/nsoption.c
+++ b/utils/nsoption.c
@@ -38,6 +38,9 @@
 #include "utils/utils.h"
 #include "utils/nsoption.h"
 
+/** Length of buffer used to read lines from input file */
+#define NSOPTION_MAX_LINE_LEN 1024
+
 struct nsoption_s *nsoptions = NULL;
 struct nsoption_s *nsoptions_default = NULL;
 
@@ -597,11 +600,12 @@ nserror nsoption_finalise(struct nsoption_s *opts, struct 
nsoption_s *defs)
        return NSERROR_OK;
 }
 
+
 /* exported interface documented in utils/nsoption.h */
 nserror
 nsoption_read(const char *path, struct nsoption_s *opts)
 {
-       char s[100];
+       char s[NSOPTION_MAX_LINE_LEN];
        FILE *fp;
        struct nsoption_s *defs;
 
@@ -625,7 +629,7 @@ nsoption_read(const char *path, struct nsoption_s *opts)
 
        LOG("Successfully opened '%s' for Options file", path);
 
-       while (fgets(s, 100, fp)) {
+       while (fgets(s, NSOPTION_MAX_LINE_LEN, fp)) {
                char *colon, *value;
                unsigned int idx;
 


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