Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/nav/panel.c

    rb336bfd8 r7cf5ddb  
    11/*
    2  * Copyright (c) 2025 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    377377}
    378378
     379/** Open panel file entry.
     380 *
     381 * Perform Open action on a file entry (i.e. try running it).
     382 *
     383 * @param panel Panel
     384 * @param fname File name
     385 *
     386 * @return EOK on success or an error code
     387 */
     388static errno_t panel_open_file(panel_t *panel, const char *fname)
     389{
     390        task_id_t id;
     391        task_wait_t wait;
     392        task_exit_t texit;
     393        int retval;
     394        errno_t rc;
     395        ui_t *ui;
     396
     397        ui = ui_window_get_ui(panel->window);
     398
     399        /* Free up and clean console for the child task. */
     400        rc = ui_suspend(ui);
     401        if (rc != EOK)
     402                return rc;
     403
     404        rc = task_spawnl(&id, &wait, fname, fname, NULL);
     405        if (rc != EOK)
     406                goto error;
     407
     408        rc = task_wait(&wait, &texit, &retval);
     409        if ((rc != EOK) || (texit != TASK_EXIT_NORMAL))
     410                goto error;
     411
     412        /* Resume UI operation */
     413        rc = ui_resume(ui);
     414        if (rc != EOK)
     415                return rc;
     416
     417        (void) ui_paint(ui_window_get_ui(panel->window));
     418        return EOK;
     419error:
     420        (void) ui_resume(ui);
     421        (void) ui_paint(ui_window_get_ui(panel->window));
     422        return rc;
     423}
     424
    379425/** File list in panel requests activation.
    380426 *
     
    400446        panel_t *panel = (panel_t *)arg;
    401447
    402         if (panel->cb != NULL && panel->cb->file_open != NULL)
    403                 panel->cb->file_open(panel->cb_arg, panel, fname);
     448        (void) panel_open_file(panel, fname);
    404449}
    405450
Note: See TracChangeset for help on using the changeset viewer.