Fri, 29 Nov 2024 22:21:36 +0100
fix gtk4 dependency
8
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2024 Olaf Wintermann. All rights reserved. |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
726b24766437
implement connecting to repositories
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 |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #ifndef IDAV_DAV_CONTROLLER_H |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | #define IDAV_DAV_CONTROLLER_H |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | #include <ui/ui.h> |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | #include <libidav/webdav.h> |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | #include <libidav/config.h> |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | #include "application.h" |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | #ifdef __cplusplus |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | extern "C" { |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | #endif |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | |
15
78684a24dc52
implement navigation back/forward buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
11
diff
changeset
|
42 | #define DAVBROWSER_MAX_NAVLIST 128 |
51
e324291ca9f8
add resource preview window
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
46
diff
changeset
|
43 | |
87
5360027fb282
download/upload refactoring, add cancel button, resolves #498 fixes #506
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
85
diff
changeset
|
44 | typedef struct TransferProgress { |
5360027fb282
download/upload refactoring, add cancel button, resolves #498 fixes #506
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
85
diff
changeset
|
45 | size_t total_bytes; |
5360027fb282
download/upload refactoring, add cancel button, resolves #498 fixes #506
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
85
diff
changeset
|
46 | size_t total_files; |
5360027fb282
download/upload refactoring, add cancel button, resolves #498 fixes #506
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
85
diff
changeset
|
47 | size_t total_directories; |
5360027fb282
download/upload refactoring, add cancel button, resolves #498 fixes #506
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
85
diff
changeset
|
48 | size_t transferred_bytes; |
5360027fb282
download/upload refactoring, add cancel button, resolves #498 fixes #506
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
85
diff
changeset
|
49 | size_t transferred_files; |
5360027fb282
download/upload refactoring, add cancel button, resolves #498 fixes #506
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
85
diff
changeset
|
50 | size_t transferred_directories; |
51
e324291ca9f8
add resource preview window
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
46
diff
changeset
|
51 | |
87
5360027fb282
download/upload refactoring, add cancel button, resolves #498 fixes #506
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
85
diff
changeset
|
52 | size_t current_file_size; |
5360027fb282
download/upload refactoring, add cancel button, resolves #498 fixes #506
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
85
diff
changeset
|
53 | size_t current_file_transferred; |
91
7ee944cf53de
add transfer speed indicator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
89
diff
changeset
|
54 | |
7ee944cf53de
add transfer speed indicator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
89
diff
changeset
|
55 | time_t speedtest_start; |
7ee944cf53de
add transfer speed indicator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
89
diff
changeset
|
56 | size_t speedtest_bytes; |
87
5360027fb282
download/upload refactoring, add cancel button, resolves #498 fixes #506
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
85
diff
changeset
|
57 | } TransferProgress; |
15
78684a24dc52
implement navigation back/forward buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
11
diff
changeset
|
58 | |
8
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | DavBrowser* davbrowser_create(UiObject *toplevel); |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | |
56
294d5515583a
add authentication dialog
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
54
diff
changeset
|
61 | int jobthr_davbrowser_auth(DavSession *sn, void *data); |
294d5515583a
add authentication dialog
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
54
diff
changeset
|
62 | void davbrowser_auth_set_user_pwd(SessionAuthData *auth, const char *user, const char *password); |
294d5515583a
add authentication dialog
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
54
diff
changeset
|
63 | |
8
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | void davbrowser_set_collection(UiObject *ui, DavBrowser *browser, DavResource *collection); |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | |
85
44ebbb4c8a13
add support for secret store credentials when connecting to repositories, resolves #496
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
78
diff
changeset
|
66 | int davbrowser_connect2repo(UiObject *ui, DavBrowser *browser, DavCfgRepository *repo, const char *path); |
8
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | void davbrowser_query_path(UiObject *ui, DavBrowser *browser, const char *path); |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | |
11
26acbfa75c1f
add handler for the path bar activate events
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
8
diff
changeset
|
70 | void davbrowser_query_url(UiObject *ui, DavBrowser *browser, const char *url); |
8
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | |
53
da05df77652e
add menu items to open resource properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
51
diff
changeset
|
72 | void davbrowser_open_resource(UiObject *ui, DavBrowser *browser, DavResource *res, const char *contenttype); |
51
e324291ca9f8
add resource preview window
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
46
diff
changeset
|
73 | |
15
78684a24dc52
implement navigation back/forward buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
11
diff
changeset
|
74 | void davbrowser_add2navstack(DavBrowser *browser, const char *base, const char *path); |
78684a24dc52
implement navigation back/forward buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
11
diff
changeset
|
75 | |
68 | 76 | void davbrowser_navigation_parent(UiObject *ui, DavBrowser *browser); |
15
78684a24dc52
implement navigation back/forward buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
11
diff
changeset
|
77 | void davbrowser_navigation_back(UiObject *ui, DavBrowser *browser); |
78684a24dc52
implement navigation back/forward buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
11
diff
changeset
|
78 | void davbrowser_navigation_forward(UiObject *ui, DavBrowser *browser); |
78684a24dc52
implement navigation back/forward buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
11
diff
changeset
|
79 | |
18
af411868ab9b
implement dnd upload (without progressbar)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
16
diff
changeset
|
80 | void davbrowser_upload_files(UiObject *ui, DavBrowser *browser, UiFileList files); |
af411868ab9b
implement dnd upload (without progressbar)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
16
diff
changeset
|
81 | |
29
3fc287f06305
add minimal working download
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
28
diff
changeset
|
82 | void davbrowser_download(UiObject *ui, DavBrowser *browser, DavResource *reslist, const char *local_path); |
3fc287f06305
add minimal working download
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
28
diff
changeset
|
83 | |
26
40d6af793c1a
implement resource deletion
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
18
diff
changeset
|
84 | void davbrowser_delete(UiObject *ui, DavBrowser *browser, UiListSelection selection); |
8
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | |
46
31bc86844659
implement action_newfile
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
86 | void davbrowser_create_resource(UiObject *ui, DavBrowser *browser, const char *name, DavBool iscollection); |
31bc86844659
implement action_newfile
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
87 | |
28
1ecc1183f046
implement new-collection toolbar button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
88 | void davbrowser_mkcol(UiObject *ui, DavBrowser *browser, const char *name); |
46
31bc86844659
implement action_newfile
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
29
diff
changeset
|
89 | void davbrowser_newfile(UiObject *ui, DavBrowser *browser, const char *name); |
28
1ecc1183f046
implement new-collection toolbar button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
26
diff
changeset
|
90 | |
89
2fbb3cac05a5
implement rename
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
87
diff
changeset
|
91 | void davbrowser_rename(UiObject *ui, DavBrowser *browser, UiListSelection selection); |
2fbb3cac05a5
implement rename
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
87
diff
changeset
|
92 | |
51
e324291ca9f8
add resource preview window
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
46
diff
changeset
|
93 | |
97
5a3d27b8e6b0
implement UI for editing properties, relates to #497
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
91
diff
changeset
|
94 | DavResourceViewer* dav_resourceviewer_create(UiObject *toplevel, DavSession *sn, const char *path, DavResourceViewType type); |
51
e324291ca9f8
add resource preview window
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
46
diff
changeset
|
95 | |
e324291ca9f8
add resource preview window
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
46
diff
changeset
|
96 | void dav_resourceviewer_load(UiObject *ui, DavResourceViewer *res); |
e324291ca9f8
add resource preview window
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
46
diff
changeset
|
97 | |
78
ad7ced6cf00b
implement resourceviewer textfile save button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
68
diff
changeset
|
98 | void dav_resourceviewer_save(UiObject *ui, DavResourceViewer *res); |
ad7ced6cf00b
implement resourceviewer textfile save button
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
68
diff
changeset
|
99 | |
54
3ca3acefc66a
add resourceviewer cleanup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
53
diff
changeset
|
100 | void dav_resourceviewer_destroy(DavResourceViewer *res); |
3ca3acefc66a
add resourceviewer cleanup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
53
diff
changeset
|
101 | |
97
5a3d27b8e6b0
implement UI for editing properties, relates to #497
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
91
diff
changeset
|
102 | void dav_resourceviewer_property_remove(DavResourceViewer *res, DavPropertyList *prop); |
5a3d27b8e6b0
implement UI for editing properties, relates to #497
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
91
diff
changeset
|
103 | void dav_resourceviewer_property_update_text(DavResourceViewer *res, DavPropertyList *prop, const char *text); |
5a3d27b8e6b0
implement UI for editing properties, relates to #497
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
91
diff
changeset
|
104 | void dav_resourceviewer_property_update_xml(DavResourceViewer *res, DavPropertyList *prop, DavXmlNode *xml); |
5a3d27b8e6b0
implement UI for editing properties, relates to #497
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
91
diff
changeset
|
105 | void dav_resourceviewer_property_add_text(DavResourceViewer *res, const char *ns, const char *name, const char *text); |
5a3d27b8e6b0
implement UI for editing properties, relates to #497
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
91
diff
changeset
|
106 | void dav_resourceviewer_property_add_xml(DavResourceViewer *res, const char *ns, const char *name, const char *nsdef, DavXmlNode *xml); |
5a3d27b8e6b0
implement UI for editing properties, relates to #497
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
91
diff
changeset
|
107 | |
5a3d27b8e6b0
implement UI for editing properties, relates to #497
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
91
diff
changeset
|
108 | |
91
7ee944cf53de
add transfer speed indicator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
89
diff
changeset
|
109 | uint64_t dav_transfer_speed(TransferProgress *progress, time_t current); |
7ee944cf53de
add transfer speed indicator
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
89
diff
changeset
|
110 | |
8
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | #ifdef __cplusplus |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | } |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | #endif |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 | #endif /* IDAV_DAV_CONTROLLER_H */ |
726b24766437
implement connecting to repositories
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
116 |