}
}
-struct NotebookCreatedResult {
+typedef struct NotebookCreatedResult {
+ MainWindow *window;
Resource *parent;
Resource *notebook;
-};
+} NotebookCreatedResult;
static void notebook_created(UiEvent *event, int64_t newid, int error, void *userdata) {
- struct NotebookCreatedResult *result = userdata;
+ NotebookCreatedResult *result = userdata;
cxListAdd(result->parent->children, result->notebook);
+ update_sublists(result->window->obj->ctx, result->window->notebooks);
free(result);
-
- // TODO: update windows
}
static void action_nnd_button(UiEvent *event, void *userdata) {
notebook->parent_id = parent->resource_id;
notebook->nodename = cx_strdup_a(store->mp->allocator, name).ptr;
- struct NotebookCreatedResult *result = malloc(sizeof(struct NotebookCreatedResult));
+ NotebookCreatedResult *result = malloc(sizeof(NotebookCreatedResult));
+ result->window = wdata->parent;
result->parent = parent;
result->notebook = notebook;
//ui_set_group(obj->ctx, NEWNOTEBOOK_DIALOG_STATE_SELECT_GROUP);
NewNotebookDialog *wdata = ui_malloc(obj->ctx, sizeof(NewNotebookDialog));
+ wdata->parent = event->window;
wdata->groups = ui_list_new(obj->ctx, NULL);
+ wdata->group_name = ui_string_new(obj->ctx, NULL);
wdata->notebook_name = ui_string_new(obj->ctx, NULL);
wdata->gs_new_group = ui_int_new(obj->ctx, NULL);
wdata->gn_new_group = ui_int_new(obj->ctx, NULL);
ui_widget_set_groups(obj->ctx, gs_button, (ui_enablefunc)ui_set_visible, NEWNOTEBOOK_DIALOG_STATE_SELECT_GROUP, -1);
UIWIDGET gn_label = ui_rlabel(obj, .label = "Group");
- UIWIDGET gn_textfield = ui_textfield(obj, .varname = "notebook_group_name", .hexpand = TRUE, .hfill = TRUE);
+ UIWIDGET gn_textfield = ui_textfield(obj, .value = wdata->group_name, .hexpand = TRUE, .hfill = TRUE);
UIWIDGET gn_button = ui_togglebutton(obj, .label = "New Group", .value = wdata->gn_new_group, .onchange = action_nnd_new_group);
ui_newline(obj);
ui_newline(obj);
ui_rlabel(obj, .label = "Name");
- ui_textfield(obj, .varname = "notebook_name", .colspan = 2, .hfill = TRUE);
+ ui_textfield(obj, .value = wdata->notebook_name, .colspan = 2, .hfill = TRUE);
}
// Dialog Data