application/application.c

Tue, 30 Jan 2024 14:01:04 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 30 Jan 2024 14:01:04 +0100
changeset 14
872d570ae843
parent 8
726b24766437
child 16
f2e79b69d233
permissions
-rw-r--r--

implement window new button

2
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2024 Olaf Wintermann. All rights reserved.
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #include "application.h"
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 #include <string.h>
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 #include <stdbool.h>
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33
6
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
34 #include <libidav/webdav.h>
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
35
2
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 #include "window.h"
6
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
37 #include "config.h"
8
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
38 #include "davcontroller.h"
2
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39
6
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
40 static DavContext* davctx;
2
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41
3
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
42 void application_init(void) {
6
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
43 davctx = dav_context_new();
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
44
3
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
45 application_create_menu();
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
46 }
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
47
2
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 void application_startup(UiEvent* event, void* data) {
6
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
50 if (load_config(davctx)) {
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
51 // TODO: error
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
52 exit(-1);
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
53 }
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
54
8
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
55 window_init();
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
56
14
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
57 // create document for global settings (repolist, ...)
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
58 DavApp *app = application_create_app_document();
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
59 UiContext *global = ui_global_context();
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
60 ui_attach_document(global, app);
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
61
8
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
62 // create new window
7
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
63 UiObject *win = window_create();
8
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
64 // create new browser document and attach it to the main window
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
65 DavBrowser *doc = davbrowser_create(win);
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
66 ui_attach_document(win->ctx, doc);
2
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68 ui_show(win);
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 }
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70
8
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
71 static void* davrepo_getname(void *elm, int unused) {
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
72 DavCfgRepository *repo = elm;
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
73 return repo->name.value.ptr;
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
74 }
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
75
2
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 void application_create_menu(void) {
3
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
77 // menu
2
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78
3
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
79
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
80 // toolbar
4
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
81 ui_toolbar_item("Home", .icon = "Home");
14
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
82 ui_toolbar_item("NewWindow", .icon = "NewWindow", .onclick = action_window_new);
3
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
83 ui_toolbar_menu("Repo", .label = "Repository") {
8
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
84 ui_menu_itemlist(.varname = "repolist", .getvalue = davrepo_getname, .onselect = action_repo_selected);
3
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
85 }
4
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
86 ui_toolbar_item("Refresh", .icon = "Refresh");
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
87 ui_toolbar_item("NewFolder", .icon = "NewFolder");
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
88 ui_toolbar_item("NewFile", .icon = "Add");
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
89 ui_toolbar_item("Upload", .label = "Upload", .icon = "Upload");
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
90 ui_toolbar_item("Download", .icon = "SaveLocal");
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
91 ui_toolbar_item("Remove", .icon = "Delete");
7
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
92 ui_toolbar_toggleitem("LocalBrowser", .icon = "DockLeft", .label = "Local Browser");
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
93 ui_toolbar_toggleitem("PreviewPane", .icon = "DockRight");
4
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
94
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
95 ui_toolbar_appmenu() {
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
96 ui_menuitem("TODO", NULL);
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
97 }
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
98
3
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
99
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
100 ui_toolbar_add_default("Home", UI_TOOLBAR_LEFT);
4
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
101 ui_toolbar_add_default("NewWindow", UI_TOOLBAR_LEFT);
3
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
102 ui_toolbar_add_default("Repo", UI_TOOLBAR_LEFT);
4
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
103
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
104 ui_toolbar_add_default("NewFolder", UI_TOOLBAR_CENTER);
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
105 ui_toolbar_add_default("NewFile", UI_TOOLBAR_CENTER);
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
106 ui_toolbar_add_default("Remove", UI_TOOLBAR_CENTER);
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
107 ui_toolbar_add_default("Download", UI_TOOLBAR_CENTER);
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
108 ui_toolbar_add_default("Upload", UI_TOOLBAR_CENTER);
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
109
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
110 ui_toolbar_add_default("LocalBrowser", UI_TOOLBAR_RIGHT);
31137432bea8 add more toolbar items
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
111 ui_toolbar_add_default("PreviewPane", UI_TOOLBAR_RIGHT);
2
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
112 }
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
113
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
114
6
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
115
2
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
116 DavApp* application_create_app_document(void) {
7
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
117 DavApp *doc = ui_document_new(sizeof(DavApp));
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
118 UiContext *ctx = ui_document_context(doc);
3
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
119 doc->repos = ui_list_new(ctx, "repolist");
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
120
6
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
121 // create repo list
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
122 application_update_repolist(doc);
3
f154867f54dc add nav buttons, update toolkit
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 2
diff changeset
123
2
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
124 return doc;
fbdfaacc4182 update ucx, libidav and add first gui code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 }
6
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
126
7
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
127 void application_update_repolist(DavApp *app) {
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
128 DavConfig *config = get_config();
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
129 DavCfgRepository *repo = config->repositories;
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
130
6
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
131 ui_list_clear(app->repos);
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
132
7
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
133 for (DavCfgRepository *repo = config->repositories; repo; repo = repo->next) {
8
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
134 ui_list_append(app->repos, repo);
6
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
135 }
09ac07345656 add config related code from dav / load config and fill repo list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 5
diff changeset
136 }
7
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
137
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
138
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
139 DavContext* application_dav_context(void) {
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
140 return davctx;
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
141 }
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
142
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
143
14
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
144 void action_window_new(UiEvent *event, void *data) {
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
145 UiObject *win = window_create();
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
146 // create new browser document and attach it to the main window
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
147 DavBrowser *doc = davbrowser_create(win);
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
148 ui_attach_document(win->ctx, doc);
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
149
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
150 ui_show(win);
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
151 }
872d570ae843 implement window new button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 8
diff changeset
152
7
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
153 void action_repo_selected(UiEvent *event, void *data) {
8
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
154 DavCfgRepository *repo = event->eventdata;
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
155 DavBrowser *browser = event->document;
726b24766437 implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 7
diff changeset
156 davbrowser_connect2repo(event->obj, browser, repo);
7
905ac52c910f port more dav config code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 6
diff changeset
157 }

mercurial