Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/1023fbf927dd03c425a1d...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/1023fbf927dd03c425a1dde...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/1023fbf927dd03c425a1dde79...
The branch, master has been updated
via 1023fbf927dd03c425a1dde7920da649f86dae3d (commit)
from 5b02d2b681398a5ba0eb8831f0829388e5be819b (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=1023fbf927dd03c425a...
commit 1023fbf927dd03c425a1dde7920da649f86dae3d
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Create the hotlist menu/toolbar folders if they don't exist.
diff --git a/amiga/hotlist.c b/amiga/hotlist.c
index 70f0143..b67ba22 100755
--- a/amiga/hotlist.c
+++ b/amiga/hotlist.c
@@ -27,6 +27,7 @@ struct ami_hotlist_ctx {
int item;
const char *folder; /* folder we're interested in */
bool in_menu; /* set if we are in that folder */
+ bool found; /* set if the folder is found */
bool (*cb)(void *userdata, int level, int item, const char *title, nsurl *url, bool
folder);
};
@@ -54,8 +55,10 @@ static nserror ami_hotlist_folder_enter_cb(void *ctx, const char
*title)
if(menu_ctx->cb(menu_ctx->userdata, menu_ctx->level, menu_ctx->item, title,
NULL, true) == true)
menu_ctx->item++;
} else {
- if((menu_ctx->level == 0) && (strcmp(title, menu_ctx->folder) == 0))
+ if((menu_ctx->level == 0) && (strcmp(title, menu_ctx->folder) == 0)) {
menu_ctx->in_menu = true;
+ menu_ctx->found = true;
+ }
}
menu_ctx->level++;
return NSERROR_OK;
@@ -88,17 +91,24 @@ static nserror ami_hotlist_folder_leave_cb(void *ctx)
nserror ami_hotlist_scan(void *userdata, int first_item, const char *folder,
bool (*cb_add_item)(void *userdata, int level, int item, const char *title, nsurl *url,
bool folder))
{
+ nserror error;
struct ami_hotlist_ctx ctx;
-
+
ctx.level = 0;
ctx.item = first_item;
ctx.folder = folder;
ctx.in_menu = false;
ctx.userdata = userdata;
ctx.cb = cb_add_item;
-
- return hotlist_iterate(&ctx,
+ ctx.found = false;
+
+ error = hotlist_iterate(&ctx,
ami_hotlist_folder_enter_cb,
ami_hotlist_address_cb,
ami_hotlist_folder_leave_cb);
+
+ if((error == NSERROR_OK) && (ctx.found == false))
+ hotlist_add_folder(folder, false, 0);
+
+ return error;
}
-----------------------------------------------------------------------
Summary of changes:
amiga/hotlist.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/amiga/hotlist.c b/amiga/hotlist.c
index 70f0143..b67ba22 100755
--- a/amiga/hotlist.c
+++ b/amiga/hotlist.c
@@ -27,6 +27,7 @@ struct ami_hotlist_ctx {
int item;
const char *folder; /* folder we're interested in */
bool in_menu; /* set if we are in that folder */
+ bool found; /* set if the folder is found */
bool (*cb)(void *userdata, int level, int item, const char *title, nsurl *url, bool
folder);
};
@@ -54,8 +55,10 @@ static nserror ami_hotlist_folder_enter_cb(void *ctx, const char
*title)
if(menu_ctx->cb(menu_ctx->userdata, menu_ctx->level, menu_ctx->item, title,
NULL, true) == true)
menu_ctx->item++;
} else {
- if((menu_ctx->level == 0) && (strcmp(title, menu_ctx->folder) == 0))
+ if((menu_ctx->level == 0) && (strcmp(title, menu_ctx->folder) == 0)) {
menu_ctx->in_menu = true;
+ menu_ctx->found = true;
+ }
}
menu_ctx->level++;
return NSERROR_OK;
@@ -88,17 +91,24 @@ static nserror ami_hotlist_folder_leave_cb(void *ctx)
nserror ami_hotlist_scan(void *userdata, int first_item, const char *folder,
bool (*cb_add_item)(void *userdata, int level, int item, const char *title, nsurl *url,
bool folder))
{
+ nserror error;
struct ami_hotlist_ctx ctx;
-
+
ctx.level = 0;
ctx.item = first_item;
ctx.folder = folder;
ctx.in_menu = false;
ctx.userdata = userdata;
ctx.cb = cb_add_item;
-
- return hotlist_iterate(&ctx,
+ ctx.found = false;
+
+ error = hotlist_iterate(&ctx,
ami_hotlist_folder_enter_cb,
ami_hotlist_address_cb,
ami_hotlist_folder_leave_cb);
+
+ if((error == NSERROR_OK) && (ctx.found == false))
+ hotlist_add_folder(folder, false, 0);
+
+ return error;
}
--
NetSurf Browser