application/application.c

changeset 46
31bc86844659
parent 43
ef01d2c90128
child 47
3ac472683246
equal deleted inserted replaced
45:ab71409644b0 46:31bc86844659
96 ui_toolbar_appmenu() { 96 ui_toolbar_appmenu() {
97 ui_menuitem("TODO", NULL); 97 ui_menuitem("TODO", NULL);
98 } 98 }
99 99
100 //ui_toolbar_add_default("Home", UI_TOOLBAR_LEFT); 100 //ui_toolbar_add_default("Home", UI_TOOLBAR_LEFT);
101 ui_toolbar_add_default("NewWindow", UI_TOOLBAR_LEFT); 101 //ui_toolbar_add_default("NewWindow", UI_TOOLBAR_LEFT);
102 ui_toolbar_add_default("Refresh", UI_TOOLBAR_LEFT); 102 //ui_toolbar_add_default("Refresh", UI_TOOLBAR_LEFT);
103 ui_toolbar_add_default("Repo", UI_TOOLBAR_LEFT); 103 ui_toolbar_add_default("Repo", UI_TOOLBAR_LEFT);
104 104
105 ui_toolbar_add_default("NewFolder", UI_TOOLBAR_CENTER); 105 ui_toolbar_add_default("NewFolder", UI_TOOLBAR_CENTER);
106 ui_toolbar_add_default("NewFile", UI_TOOLBAR_CENTER); 106 ui_toolbar_add_default("NewFile", UI_TOOLBAR_CENTER);
107 ui_toolbar_add_default("Remove", UI_TOOLBAR_CENTER); 107 ui_toolbar_add_default("Remove", UI_TOOLBAR_CENTER);
244 davbrowser_delete(event->obj, browser, sel); 244 davbrowser_delete(event->obj, browser, sel);
245 } 245 }
246 ui_listselection_free(sel); 246 ui_listselection_free(sel);
247 } 247 }
248 248
249 static void newfiledialog_result(UiEvent *event, void *data) {
250 DavBrowser *browser = event->document;
251 char *path = event->eventdata;
252 if (event->intval == 1) {
253 davbrowser_newfile(event->obj, browser, path);
254 }
255 }
256
249 void action_newfile(UiEvent *event, void *data) { 257 void action_newfile(UiEvent *event, void *data) {
250 258 DavBrowser *browser = event->document;
259 if(!browser->sn) {
260 return;
261 }
262
263 ui_dialog(event->obj,
264 .content = "New File",
265 .input = TRUE,
266 .button1_label = "Create File",
267 .button2_label = "Cancel",
268 .result = newfiledialog_result);
251 } 269 }
252 270
253 271
254 static void newfolderdialog_result(UiEvent *event, void *data) { 272 static void newfolderdialog_result(UiEvent *event, void *data) {
255 DavBrowser *browser = event->document; 273 DavBrowser *browser = event->document;
258 davbrowser_mkcol(event->obj, browser, path); 276 davbrowser_mkcol(event->obj, browser, path);
259 } 277 }
260 } 278 }
261 279
262 void action_mkcol(UiEvent *event, void *data) { 280 void action_mkcol(UiEvent *event, void *data) {
263 ui_dialog(event->obj, .content = "New Folder", .input = TRUE, .button1_label = "Create Folder", .button2_label = "Close", .result = newfolderdialog_result); 281 DavBrowser *browser = event->document;
264 } 282 if(!browser->sn) {
283 return;
284 }
285
286
287 ui_dialog(event->obj,
288 .content = "New Folder",
289 .input = TRUE,
290 .button1_label = "Create Folder",
291 .button2_label = "Cancel",
292 .result = newfolderdialog_result);
293 }

mercurial