diff -r 5a8762fcfecc -r 872d570ae843 application/application.c --- a/application/application.c Tue Jan 30 13:31:25 2024 +0100 +++ b/application/application.c Tue Jan 30 14:01:04 2024 +0100 @@ -54,17 +54,17 @@ window_init(); + // create document for global settings (repolist, ...) + DavApp *app = application_create_app_document(); + UiContext *global = ui_global_context(); + ui_attach_document(global, app); + // create new window UiObject *win = window_create(); // create new browser document and attach it to the main window DavBrowser *doc = davbrowser_create(win); ui_attach_document(win->ctx, doc); - // create document for global settings (repolist, ...) - DavApp *app = application_create_app_document(); - UiContext *global = ui_global_context(); - ui_attach_document(global, app); - ui_show(win); } @@ -79,7 +79,7 @@ // toolbar ui_toolbar_item("Home", .icon = "Home"); - ui_toolbar_item("NewWindow", .icon = "NewWindow"); + ui_toolbar_item("NewWindow", .icon = "NewWindow", .onclick = action_window_new); ui_toolbar_menu("Repo", .label = "Repository") { ui_menu_itemlist(.varname = "repolist", .getvalue = davrepo_getname, .onselect = action_repo_selected); } @@ -141,6 +141,15 @@ } +void action_window_new(UiEvent *event, void *data) { + UiObject *win = window_create(); + // create new browser document and attach it to the main window + DavBrowser *doc = davbrowser_create(win); + ui_attach_document(win->ctx, doc); + + ui_show(win); +} + void action_repo_selected(UiEvent *event, void *data) { DavCfgRepository *repo = event->eventdata; DavBrowser *browser = event->document;