107 ui_set(win->progress, on); |
107 ui_set(win->progress, on); |
108 } |
108 } |
109 |
109 |
110 |
110 |
111 |
111 |
112 |
112 static void resourceviewer_close(UiEvent *event, void *data) { |
|
113 DavResourceViewer *doc = data; |
|
114 doc->window_closed = TRUE; |
|
115 if(doc->loaded) { |
|
116 dav_resourceviewer_destroy(doc); |
|
117 } |
|
118 } |
113 |
119 |
114 void resourceviewer_new(DavBrowser *browser, const char *path, DavResourceViewType type) { |
120 void resourceviewer_new(DavBrowser *browser, const char *path, DavResourceViewType type) { |
115 const char *name = util_resource_name(path); |
121 const char *name = util_resource_name(path); |
116 UiObject *win = ui_simple_window(name, NULL); |
122 UiObject *win = ui_simple_window(name, NULL); |
117 |
123 |
118 DavResourceViewer *doc = dav_resourceviewer_create(browser->sn, path, type); |
124 DavResourceViewer *doc = dav_resourceviewer_create(browser->sn, path, type); |
119 ui_attach_document(win->ctx, doc); |
125 ui_attach_document(win->ctx, doc); |
|
126 ui_context_closefunc(win->ctx, resourceviewer_close, doc); |
120 |
127 |
121 ui_tabview(win, .tabview = UI_TABVIEW_INVISIBLE, .varname = "tabview") { |
128 ui_tabview(win, .tabview = UI_TABVIEW_INVISIBLE, .varname = "tabview") { |
122 /* loading / message tab */ |
129 /* loading / message tab */ |
123 ui_tab(win, NULL) { |
130 ui_tab(win, NULL) { |
124 ui_hbox(win, .margin = 16, .spacing = 10, .fill = UI_OFF) { |
131 ui_hbox(win, .margin = 16, .spacing = 10, .fill = UI_OFF) { |