ui_show(obj);
}
+static void* reslist_getvalue(void *data, int col) {
+ Resource *resource = data;
+ switch(col) {
+ case 0: {
+ return resource->displayname ? resource->displayname : resource->nodename;
+ }
+ case 1: {
+ //return note->lastmodified ? strdup(note->lastmodified) : NULL;
+ return NULL; // TODO
+ }
+ }
+
+ return NULL;
+}
+
void action_notebook_config(UiEvent *event, void *userdata) {
+ NoteStore *store = note_store_get();
+ // TODO: check store->root and show different dialog, when root is missing
+
UiObject *obj = ui_simple_window("Notebooks", NULL);
NotebookConfigDialog *wdata = ui_malloc(obj->ctx, sizeof(NotebookConfigDialog));
wdata->tab2_repositories = ui_list_new(obj->ctx, NULL);
// fill data
-
+ CxIterator i = cxListIterator(store->root->children);
+ cx_foreach(Resource *, res, i) {
+ ui_list_append(wdata->tab1_groups, res);
+ ui_list_append(wdata->tab2_groups, res);
+ CxIterator k = cxListIterator(res->children);
+ cx_foreach(Resource *, nb, k) {
+ ui_list_append(wdata->tab2_notebooks, nb);
+ }
+ }
// UI
ui_tab(obj, "Groups") {
ui_hbox(obj, .margin = 10, .spacing = 10, .fill = UI_ON) {
ui_vbox(obj, .fill = UI_OFF) {
- ui_listview(obj, .list = wdata->tab1_groups, .fill = UI_ON);
+ ui_listview(obj, .list = wdata->tab1_groups, .getvalue = reslist_getvalue, .fill = UI_ON);
ui_hbox(obj, .fill = UI_OFF) {
ui_button(obj, .icon = UI_ICON_NEW_FOLDER);
ui_button(obj, .icon = UI_ICON_DELETE);
ui_tab(obj, "Notebooks") {
ui_hbox(obj, .margin = 10, .spacing = 10, .fill = UI_ON) {
ui_vbox(obj, .fill = UI_OFF) {
- ui_listview(obj, .list = wdata->tab2_groups, .fill = UI_ON);
+ ui_listview(obj, .list = wdata->tab2_notebooks, .getvalue = reslist_getvalue, .fill = UI_ON);
ui_hbox(obj, .fill = UI_OFF) {
ui_button(obj, .icon = UI_ICON_NEW_FOLDER);
ui_button(obj, .icon = UI_ICON_DELETE);
ui_grid(obj, .columnspacing = 10, .rowspacing = 10, .fill = UI_ON, .def_vfill = TRUE) {
ui_rlabel(obj, .label = "Group");
- ui_combobox(obj, .list = wdata->tab2_groups);
+ ui_combobox(obj, .list = wdata->tab2_groups, .getvalue = reslist_getvalue);
ui_newline(obj);
ui_rlabel(obj, .label = "Name");