Changeset b336bfd8 in mainline for uspace/app/nav/panel.c


Ignore:
Timestamp:
2025-02-06T20:42:14Z (6 days ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
a7a16a2f
Parents:
accdf882
Message:

Start text editor if open action is used on .txt file.

File:
1 edited

Legend:

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

    raccdf882 rb336bfd8  
    11/*
    2  * Copyright (c) 2023 Jiri Svoboda
     2 * Copyright (c) 2025 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  */
    388 static 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;
    419 error:
    420         (void) ui_resume(ui);
    421         (void) ui_paint(ui_window_get_ui(panel->window));
    422         return rc;
    423 }
    424 
    425379/** File list in panel requests activation.
    426380 *
     
    446400        panel_t *panel = (panel_t *)arg;
    447401
    448         (void) panel_open_file(panel, fname);
     402        if (panel->cb != NULL && panel->cb->file_open != NULL)
     403                panel->cb->file_open(panel->cb_arg, panel, fname);
    449404}
    450405
Note: See TracChangeset for help on using the changeset viewer.