#include <cx/properties.h>
#include <libidav/utils.h>
-static CxList *bookmarks;
+static CxList *cfg_default_dirs;
+
+static CxList *cfg_bookmarks;
void bookmarks_init(void) {
- bookmarks = cxArrayListCreateSimple(sizeof(MZBookmark), 8);
+ cfg_default_dirs = cxArrayListCreateSimple(sizeof(MZBookmark), 8);
+ cfg_bookmarks = cxArrayListCreateSimple(sizeof(MZBookmark), 8);
+
+ bookmarks_import_xdg_user_dirs(cfg_bookmarks, NULL);
- bookmarks_import_xdg_user_dirs(bookmarks, NULL);
+ MZBookmark def;
+ def.icon = "user-home-symbolic";
+ def.path = strdup(getenv("HOME"));
+ def.name = util_resource_name(def.path);
+ def.sort = 0;
+ cxListAdd(cfg_default_dirs, &def);
}
void bookmarks_import_xdg_user_dirs(CxList *list, const char *optional_path) {
} else {
bookmark_path = cx_strdup(value);
}
-
+
const char *icon = "folder-symbolic";
if(!cx_strcmp(key, CX_STR("XDG_DOWNLOAD_DIR"))) {
icon = "folder-download-symbolic";
close(fd);
}
-void bookmarks_init_windowdata(UiList *list) {
- CxIterator i = cxListIterator(bookmarks);
- cx_foreach(MZBookmark *, bookmark, i) {
- ui_list_append(list, bookmark);
+void bookmarks_init_windowdata(UiList *default_dirs, UiList *bookmarks) {
+ CxIterator i = cxListIterator(cfg_default_dirs);
+ cx_foreach(MZBookmark*, bookmark, i) {
+ ui_list_append(default_dirs, bookmark);
+ }
+
+ i = cxListIterator(cfg_bookmarks);
+ cx_foreach(MZBookmark*, bookmark, i) {
+ ui_list_append(bookmarks, bookmark);
}
}