diff --git a/lang/cs_CZ.lang b/lang/cs_CZ.lang index 12ec70dddd..4477d5ea2a 100644 --- a/lang/cs_CZ.lang +++ b/lang/cs_CZ.lang @@ -1446,6 +1446,10 @@ msg: URL id: Video msg: Video +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/de_DE.lang b/lang/de_DE.lang index 36895f89b3..250dbf7d5c 100644 --- a/lang/de_DE.lang +++ b/lang/de_DE.lang @@ -1285,6 +1285,9 @@ msg: URL id: Video msg: Video +id: Show bookmarks in a subdirectory +msg: Lesezeichen in Unterverzeichnis anzeigen + # # ./src/networking/connman.c # diff --git a/lang/dk_DK.lang b/lang/dk_DK.lang index cb82853e1e..6b953e402a 100644 --- a/lang/dk_DK.lang +++ b/lang/dk_DK.lang @@ -1354,6 +1354,10 @@ msg: URL id: Video msg: Video +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/el_EL.lang b/lang/el_EL.lang index 7eea666b28..963df8fcb4 100644 --- a/lang/el_EL.lang +++ b/lang/el_EL.lang @@ -1342,6 +1342,10 @@ msg: URL id: Video msg: Βίντεο +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/fi_FI.lang b/lang/fi_FI.lang index 4449ca5489..280c99376e 100644 --- a/lang/fi_FI.lang +++ b/lang/fi_FI.lang @@ -1341,6 +1341,10 @@ msg: URL id: Video msg: Video +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/fr_FR.lang b/lang/fr_FR.lang index 013ae16ca3..b7dfc5a57e 100644 --- a/lang/fr_FR.lang +++ b/lang/fr_FR.lang @@ -1268,6 +1268,10 @@ msg: URL id: Video msg: Vidéo +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/hu_HU.lang b/lang/hu_HU.lang index 38f720cf5e..682d45dbbe 100644 --- a/lang/hu_HU.lang +++ b/lang/hu_HU.lang @@ -1236,6 +1236,10 @@ msg: URL id: Video msg: Videó +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/it_IT.lang b/lang/it_IT.lang index 61679dcb6c..0a7e8e3920 100644 --- a/lang/it_IT.lang +++ b/lang/it_IT.lang @@ -1297,6 +1297,10 @@ msg: URL id: Video msg: Video +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/ja_JP.lang b/lang/ja_JP.lang index e9ed13300e..bd953548ad 100644 --- a/lang/ja_JP.lang +++ b/lang/ja_JP.lang @@ -1307,6 +1307,10 @@ msg: URL id: Video msg: ビデオ +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/mk_MK.lang b/lang/mk_MK.lang index 3ab2584852..c94cf74070 100644 --- a/lang/mk_MK.lang +++ b/lang/mk_MK.lang @@ -1240,6 +1240,10 @@ msg: URL id: Video msg: Видео +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/nl_NL.lang b/lang/nl_NL.lang index 054c3b2bee..f3fccab15a 100644 --- a/lang/nl_NL.lang +++ b/lang/nl_NL.lang @@ -1430,6 +1430,10 @@ msg: URL id: Video msg: Video +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/pl_PL.lang b/lang/pl_PL.lang index ddb9ae1007..c30abdbee9 100644 --- a/lang/pl_PL.lang +++ b/lang/pl_PL.lang @@ -1233,6 +1233,10 @@ msg: Adres URL id: Video msg: Video +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/pt_BR.lang b/lang/pt_BR.lang index 7463df24a0..0ed8d2706e 100644 --- a/lang/pt_BR.lang +++ b/lang/pt_BR.lang @@ -1430,6 +1430,10 @@ msg: URL id: Video msg: Video +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/pt_PT.lang b/lang/pt_PT.lang index 635e4adc08..65544eacce 100644 --- a/lang/pt_PT.lang +++ b/lang/pt_PT.lang @@ -1341,6 +1341,10 @@ msg: Endereço id: Video msg: Vídeo +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/ru_RU.lang b/lang/ru_RU.lang index 942244b296..857bcf09f5 100644 --- a/lang/ru_RU.lang +++ b/lang/ru_RU.lang @@ -1238,6 +1238,10 @@ msg: URL id: Video msg: Видео +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/sk_SK.lang b/lang/sk_SK.lang index aac4873237..cc8c993cd0 100644 --- a/lang/sk_SK.lang +++ b/lang/sk_SK.lang @@ -1238,6 +1238,10 @@ msg: URL adresa id: Video msg: Video +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/sp_SP.lang b/lang/sp_SP.lang index ff81ec69e6..6cd7e23393 100644 --- a/lang/sp_SP.lang +++ b/lang/sp_SP.lang @@ -1341,6 +1341,10 @@ msg: URL id: Video msg: Vídeo +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/sv_SV.lang b/lang/sv_SV.lang index f0e206d20c..dbcb3f93ac 100644 --- a/lang/sv_SV.lang +++ b/lang/sv_SV.lang @@ -1233,6 +1233,10 @@ msg: URL id: Video msg: Video +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/ua_UA.lang b/lang/ua_UA.lang index a50afcbf8d..1f9b3f6321 100644 --- a/lang/ua_UA.lang +++ b/lang/ua_UA.lang @@ -1341,6 +1341,10 @@ msg: URL id: Video msg: Відео +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/lang/zh_CN.lang b/lang/zh_CN.lang index 30fa2e2de8..0621596577 100644 --- a/lang/zh_CN.lang +++ b/lang/zh_CN.lang @@ -1234,6 +1234,10 @@ msg: URL id: Video msg: 视频 +id: Show bookmarks in a subdirectory +# Missing translation +msg: + # # ./src/networking/connman.c # diff --git a/src/navigator.c b/src/navigator.c index 2148f23830..84af513d80 100644 --- a/src/navigator.c +++ b/src/navigator.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 Lonelycoder AB + * Copyright (C) 2007-2018 Lonelycoder AB * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -163,7 +163,7 @@ typedef struct nav_page { typedef struct navigator { LIST_ENTRY(navigator) nav_link; - + struct nav_page_queue nav_pages; struct nav_page_queue nav_history; @@ -220,7 +220,7 @@ nav_update_bookmarked(void) LIST_FOREACH(nav, &navigators, nav_link) { nav_page_t *np; TAILQ_FOREACH(np, &nav->nav_pages, np_global_link) { - prop_set_int_ex(np->np_bookmarked, + prop_set_int_ex(np->np_bookmarked, np->np_bookmarked_sub, nav_page_is_bookmarked(np)); } } @@ -637,7 +637,7 @@ nav_page_setup_prop(nav_page_t *np, const char *view) np->np_url); prop_t *prev = prop_create(np->np_prop_root, "previous"); - + if(np->np_parent_model_src) { np->np_parent_model_dst = prop_create_r(prev, "parentModel"); prop_link(np->np_parent_model_src, np->np_parent_model_dst); @@ -654,7 +654,7 @@ nav_page_setup_prop(nav_page_t *np, const char *view) prop_set(np->np_prop_root, "how", PROP_SET_STRING, np->np_how); // XXX Change this into event-style subscription - np->np_close_sub = + np->np_close_sub = prop_subscribe(0, PROP_TAG_NAMED_ROOT, np->np_prop_root, "page", PROP_TAG_NAME("page", "close"), @@ -665,7 +665,7 @@ nav_page_setup_prop(nav_page_t *np, const char *view) prop_set(np->np_prop_root, "url", PROP_SET_STRING, np->np_url); prop_set(np->np_prop_root, "parentUrl", PROP_SET_STRING, np->np_parent_url); - np->np_direct_close_sub = + np->np_direct_close_sub = prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE, PROP_TAG_NAMED_ROOT, np->np_prop_root, "page", PROP_TAG_NAME("page", "directClose"), @@ -673,7 +673,7 @@ nav_page_setup_prop(nav_page_t *np, const char *view) PROP_TAG_MUTEX, &nav_mutex, NULL); - np->np_eventsink_sub = + np->np_eventsink_sub = prop_subscribe(0, PROP_TAG_NAMED_ROOT, np->np_prop_root, "page", PROP_TAG_NAME("page", "eventSink"), @@ -687,7 +687,7 @@ nav_page_setup_prop(nav_page_t *np, const char *view) prop_set_int(np->np_bookmarked, nav_page_is_bookmarked(np)); - np->np_bookmarked_sub = + np->np_bookmarked_sub = prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE | PROP_SUB_IGNORE_VOID, PROP_TAG_ROOT, np->np_bookmarked, PROP_TAG_CALLBACK_INT, nav_page_bookmarked_set, np, @@ -1231,6 +1231,8 @@ bm_delete(void *opaque, prop_event_t event, ...) } +static int bookmarks_subdir_flag; +static service_t *bookmarks_subdir_service; /** * @@ -1267,8 +1269,8 @@ bookmark_add(const char *title, const char *url, const char *type, bm->bm_id = rstr_alloc(id); bm->bm_service = service_create(rstr_get(bm->bm_id), - title, url, type, icon, 1, 1, - SVC_ORIGIN_BOOKMARK); + title, url, type, icon, 1, !bookmarks_subdir_flag, + SVC_ORIGIN_BOOKMARK); prop_link(service_get_status_prop(bm->bm_service), prop_create(p, "status")); @@ -1511,6 +1513,70 @@ bookmark_eventsink(void *opaque, event_t *e) } } +/** + * + */ +static void +bookmarks_subdir_callback(void *opaque, int value) +{ + bookmarks_subdir_flag = value; + + prop_set(bookmarks_subdir_service->s_root, "enabled", PROP_SET_INT, value); + + bookmark_t *bm; + LIST_FOREACH(bm, &bookmarks, bm_link) { + prop_set(bm->bm_service->s_root, "enabled", PROP_SET_INT, !value); + } +} + +/** + * + */ +static int +bookmarks_subdir_canhandle(const char *url) +{ + return !strcmp(url, "bookmarks_subdir:"); +} + +/** + * + */ +static int +bookmarks_subdir_open_url(prop_t *page, const char *url, int sync) +{ + prop_t *model = prop_create_r(page, "model"); + + prop_setv(model, "metadata", "title", NULL, + PROP_SET_LINK, _p("Bookmarks")); + + prop_set(model, "type", PROP_SET_STRING, "directory"); + + prop_t *nodes = prop_create_r(model, "nodes"); + + bookmark_t *bm; + LIST_FOREACH(bm, &bookmarks, bm_link) { + prop_t *p = prop_create(nodes, NULL); + prop_set(p, "type", PROP_SET_STRING, "directory"); + prop_setv(p, "metadata", "title", NULL, PROP_SET_STRING, rstr_get(bm->bm_title)); + prop_setv(p, "metadata", "icon", NULL, PROP_SET_STRING, rstr_get(bm->bm_icon)); + prop_set(p, "url", PROP_SET_STRING, rstr_get(bm->bm_url)); + } + + prop_ref_dec(nodes); + prop_ref_dec(model); + return 0; +} + +/** + * + */ +static backend_t be_bookmarks_subdir = { + .be_canhandle = bookmarks_subdir_canhandle, + .be_open = bookmarks_subdir_open_url, +}; + +BE_REGISTER(bookmarks_subdir); + /** * */ @@ -1525,6 +1591,18 @@ bookmarks_init(void) _p("Add and remove items on homepage"), "settings:bookmarks"); + bookmarks_subdir_service = service_createp("bookmarks_subdir_service", + _p("Bookmarks"), "bookmarks_subdir:", "directory", + "skin://icons/ic_collections_bookmark_24px.svg", 1, + bookmarks_subdir_flag, SVC_ORIGIN_SYSTEM); + + setting_create(SETTING_BOOL, root, SETTINGS_INITIAL_UPDATE, + SETTING_TITLE(_p("Show bookmarks in a subdirectory")), + SETTING_VALUE(0), + SETTING_CALLBACK(bookmarks_subdir_callback, NULL), + SETTING_STORE("bookmarks_settings", "bookmarks_subdir"), + NULL); + bookmark_nodes = prop_create(root, "nodes"); prop_set(root, "mayadd", PROP_SET_INT, 1);