Changes in uspace/app/nav/nav.c [accdf882:54ddb59] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nav/nav.c
raccdf882 r54ddb59 1 1 /* 2 * Copyright (c) 202 5Jiri Svoboda2 * Copyright (c) 2022 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 39 39 #include <stdlib.h> 40 40 #include <str.h> 41 #include <task.h>42 41 #include <ui/fixed.h> 43 42 #include <ui/filelist.h> … … 49 48 #include "panel.h" 50 49 51 #define EDITOR_CMD "/app/edit"52 53 50 static void wnd_close(ui_window_t *, void *); 54 51 static void wnd_kbd(ui_window_t *, void *, kbd_event_t *); … … 60 57 61 58 static void navigator_file_open(void *); 62 static void navigator_file_edit(void *);63 59 static void navigator_file_exit(void *); 64 60 65 61 static nav_menu_cb_t navigator_menu_cb = { 66 62 .file_open = navigator_file_open, 67 .file_edit = navigator_file_edit,68 63 .file_exit = navigator_file_exit 69 64 }; … … 102 97 (event->mods & KM_CTRL) != 0) { 103 98 switch (event->key) { 104 case KC_E:105 navigator_file_edit((void *)navigator);106 break;107 99 case KC_Q: 108 100 ui_quit(navigator->ui); … … 326 318 } 327 319 328 /** Open file in text editor.329 *330 * @param panel Panel331 * @param fname File name332 *333 * @return EOK on success or an error code334 */335 static errno_t navigator_edit_file(navigator_t *navigator, const char *fname)336 {337 task_id_t id;338 task_wait_t wait;339 task_exit_t texit;340 int retval;341 errno_t rc;342 343 /* Free up and clean console for the child task. */344 rc = ui_suspend(navigator->ui);345 if (rc != EOK)346 return rc;347 348 rc = task_spawnl(&id, &wait, EDITOR_CMD, EDITOR_CMD, fname, NULL);349 if (rc != EOK)350 goto error;351 352 rc = task_wait(&wait, &texit, &retval);353 if ((rc != EOK) || (texit != TASK_EXIT_NORMAL))354 goto error;355 356 /* Resume UI operation */357 rc = ui_resume(navigator->ui);358 if (rc != EOK)359 return rc;360 361 (void) ui_paint(navigator->ui);362 return EOK;363 error:364 (void) ui_resume(navigator->ui);365 (void) ui_paint(navigator->ui);366 return rc;367 }368 369 /** File / Edit menu entry selected */370 static void navigator_file_edit(void *arg)371 {372 navigator_t *navigator = (navigator_t *)arg;373 ui_file_list_entry_t *entry;374 ui_file_list_entry_attr_t attr;375 panel_t *panel;376 377 panel = navigator_get_active_panel(navigator);378 entry = ui_file_list_get_cursor(panel->flist);379 ui_file_list_entry_get_attr(entry, &attr);380 381 (void)navigator_edit_file(navigator, attr.name);382 }383 384 320 /** File / Exit menu entry selected */ 385 321 static void navigator_file_exit(void *arg)
Note:
See TracChangeset
for help on using the changeset viewer.