Changeset 14cbf07 in mainline for uspace/app/display-cfg/seats.c


Ignore:
Timestamp:
2023-05-15T16:19:52Z (11 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2b5628c, 8a4ceaa
Parents:
aace43d8
Message:

Fill in tests seats_list_populate and avail_devices_insert

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/display-cfg/seats.c

    raace43d8 r14cbf07  
    5050#include "seats.h"
    5151
    52 static errno_t dcfg_seats_list_populate(dcfg_seats_t *);
    5352static errno_t dcfg_seats_asgn_dev_list_populate(dcfg_seats_t *);
    5453static errno_t dcfg_seats_avail_dev_list_populate(dcfg_seats_t *,
     
    118117        ui_resource_t *ui_res;
    119118        dcfg_seats_t *seats;
    120         dcfg_seats_entry_t *entry;
    121119        gfx_rect_t rect;
    122         char *caption = NULL;
    123         errno_t rc;
    124         int rv;
     120        errno_t rc;
    125121
    126122        ui_res = ui_window_get_res(dcfg->window);
     
    204200        ui_list_set_cb(seats->seat_list, &dcfg_seats_list_cb, (void *)seats);
    205201
    206         rc = dcfg_seats_list_populate(seats);
    207         if (rc != EOK)
    208                 goto error;
    209 
    210202        /* 'Add...' seat button */
    211203
     
    272264        /* 'Devices assigned to seat 'xxx':' label */
    273265
    274         entry = dcfg_seats_get_selected(seats);
    275         rv = asprintf(&caption, "Devices assigned to seat '%s':", entry->name);
    276         if (rv < 0) {
    277                 rc = ENOMEM;
    278                 goto error;
    279         }
    280 
    281         rc = ui_label_create(ui_res, caption, &seats->devices_label);
     266        rc = ui_label_create(ui_res, "Devices assigned to seat 'xxx':",
     267            &seats->devices_label);
    282268        if (rc != EOK) {
    283269                printf("Error creating label.\n");
    284270                goto error;
    285271        }
    286 
    287         free(caption);
    288         caption = NULL;
    289272
    290273        if (ui_resource_is_textmode(ui_res)) {
     
    400383        ui_tab_add(seats->tab, ui_fixed_ctl(seats->fixed));
    401384
    402         rc = dcfg_seats_asgn_dev_list_populate(seats);
    403         if (rc != EOK)
    404                 goto error;
    405 
    406385        *rseats = seats;
    407386        return EOK;
     
    411390        if (seats->add_device != NULL)
    412391                ui_pbutton_destroy(seats->add_device);
    413         if (caption != NULL)
    414                 free(caption);
    415392        if (seats->devices_label != NULL)
    416393                ui_label_destroy(seats->devices_label);
     
    431408}
    432409
     410/** Populate seats tab with display configuration service data
     411 *
     412 * @param dcfg Display configuration dialog
     413 * @param rseats Place to store pointer to new seat configuration tab
     414 * @return EOK on success or an error code
     415 */
     416errno_t dcfg_seats_populate(dcfg_seats_t *seats)
     417{
     418        dcfg_seats_entry_t *entry;
     419        errno_t rc;
     420
     421        printf("seats list populate\n");
     422        rc = dcfg_seats_list_populate(seats);
     423        if (rc != EOK)
     424                return rc;
     425
     426        /*
     427         * Update "Devices assigned to seat 'xxx'" label and populate
     428         * assigned devices list.
     429         */
     430        entry = dcfg_seats_get_selected(seats);
     431        dcfg_seats_list_selected(entry->lentry, (void *)entry);
     432        return EOK;
     433}
     434
    433435/** Destroy display configuration dialog.
    434436 *
     
    511513 * @return EOK on success or an error code
    512514 */
    513 static errno_t dcfg_seats_list_populate(dcfg_seats_t *seats)
     515errno_t dcfg_seats_list_populate(dcfg_seats_t *seats)
    514516{
    515517        size_t i;
     
    594596 * @return EOK on success or an error code
    595597 */
    596 static errno_t dcfg_avail_devices_insert(dcfg_seats_t *seats,
     598errno_t dcfg_avail_devices_insert(dcfg_seats_t *seats,
    597599    ui_select_dialog_t *dialog, const char *name, service_id_t svc_id)
    598600{
Note: See TracChangeset for help on using the changeset viewer.