Tue, 30 Jan 2024 14:01:04 +0100
implement window new button
--- 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;
--- a/application/application.h Tue Jan 30 13:31:25 2024 +0100 +++ b/application/application.h Tue Jan 30 14:01:04 2024 +0100 @@ -90,6 +90,8 @@ DavContext* application_dav_context(void); +void action_window_new(UiEvent *event, void *data); + void action_repo_selected(UiEvent *event, void *data); #ifdef __cplusplus