Changeset b279899 in mainline


Ignore:
Timestamp:
2023-10-17T12:18:10Z (14 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d4643db
Parents:
4030072
git-author:
Jiri Svoboda <jiri@…> (2023-10-16 18:17:59)
git-committer:
Jiri Svoboda <jiri@…> (2023-10-17 12:18:10)
Message:

Rename startmenu library to tbarcfg

There may be other aspects of task bar that will need configuring
so let's widen the scope of the library a bit.

Location:
uspace
Files:
1 added
1 deleted
5 edited
8 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/taskbar/meson.build

    r4030072 rb279899  
    2727#
    2828
    29 deps = [ 'startmenu', 'ui', 'wndmgt' ]
     29deps = [ 'tbarcfg', 'ui', 'wndmgt' ]
    3030src = files(
    3131        'clock.c',
     
    4949
    5050if install_nonessential_data
    51         installed_data += { 'name': 'startmenu.sif', 'dir': '/cfg' }
     51        installed_data += { 'name': 'taskbar.sif', 'dir': '/cfg' }
    5252endif
  • uspace/app/taskbar/taskbar.c

    r4030072 rb279899  
    201201        }
    202202
    203         rc = tbsmenu_load(taskbar->tbsmenu, "/cfg/startmenu.sif");
     203        rc = tbsmenu_load(taskbar->tbsmenu, "/cfg/taskbar.sif");
    204204        if (rc != EOK) {
    205205                printf("Error loading start menu from '%s'.\n",
    206                     "/cfg/startmenu.sif");
     206                    "/cfg/taskbar.sif");
    207207                goto error;
    208208        }
  • uspace/app/taskbar/tbsmenu.c

    r4030072 rb279899  
    3434
    3535#include <gfx/coord.h>
    36 #include <startmenu/startmenu.h>
    3736#include <stdbool.h>
    3837#include <stddef.h>
     
    4039#include <str.h>
    4140#include <task.h>
     41#include <tbarcfg/tbarcfg.h>
    4242#include <ui/fixed.h>
    4343#include <ui/menu.h>
     
    127127{
    128128        tbsmenu_entry_t *tentry;
    129         startmenu_t *smenu = NULL;
    130         startmenu_entry_t *sme;
     129        tbarcfg_t *tbcfg = NULL;
     130        smenu_entry_t *sme;
    131131        const char *caption;
    132132        const char *cmd;
    133133        errno_t rc;
    134134
    135         rc = startmenu_open(repopath, &smenu);
    136         if (rc != EOK)
    137                 goto error;
    138 
    139         sme = startmenu_first(smenu);
     135        rc = tbarcfg_open(repopath, &tbcfg);
     136        if (rc != EOK)
     137                goto error;
     138
     139        sme = tbarcfg_smenu_first(tbcfg);
    140140        while (sme != NULL) {
    141                 caption = startmenu_entry_get_caption(sme);
    142                 cmd = startmenu_entry_get_cmd(sme);
     141                caption = smenu_entry_get_caption(sme);
     142                cmd = smenu_entry_get_cmd(sme);
    143143
    144144                rc = tbsmenu_add(tbsmenu, caption, cmd, &tentry);
     
    148148                (void)tentry;
    149149
    150                 sme = startmenu_next(sme);
    151         }
    152 
    153         startmenu_close(smenu);
     150                sme = tbarcfg_smenu_next(sme);
     151        }
     152
     153        tbarcfg_close(tbcfg);
    154154        return EOK;
    155155error:
    156         if (smenu != NULL)
    157                 startmenu_close(smenu);
     156        if (tbcfg != NULL)
     157                tbarcfg_close(tbcfg);
    158158        return rc;
    159159}
  • uspace/lib/meson.build

    r4030072 rb279899  
    8080        'scsi',
    8181        'sif',
    82         'startmenu',
     82        'tbarcfg',
    8383        'trackmod',
    8484        'untar',
  • uspace/lib/tbarcfg/include/tbarcfg/tbarcfg.h

    r4030072 rb279899  
    2727 */
    2828
    29 /** @addtogroup libstartmenu
     29/** @addtogroup libtbarcfg
    3030 * @{
    3131 */
     
    3434 */
    3535
    36 #ifndef _STARTMENU_STARTMENU_H
    37 #define _STARTMENU_STARTMENU_H
     36#ifndef _TBARCFG_TBARCFG_H
     37#define _TBARCFG_TBARCFG_H
    3838
    3939#include <errno.h>
    40 #include <types/startmenu/startmenu.h>
     40#include <types/tbarcfg/tbarcfg.h>
    4141
    42 extern errno_t startmenu_open(const char *, startmenu_t **);
    43 extern void startmenu_close(startmenu_t *);
    44 extern startmenu_entry_t *startmenu_first(startmenu_t *);
    45 extern startmenu_entry_t *startmenu_next(startmenu_entry_t *);
    46 extern const char *startmenu_entry_get_caption(startmenu_entry_t *);
    47 extern const char *startmenu_entry_get_cmd(startmenu_entry_t *);
     42extern errno_t tbarcfg_open(const char *, tbarcfg_t **);
     43extern void tbarcfg_close(tbarcfg_t *);
     44extern smenu_entry_t *tbarcfg_smenu_first(tbarcfg_t *);
     45extern smenu_entry_t *tbarcfg_smenu_next(smenu_entry_t *);
     46extern const char *smenu_entry_get_caption(smenu_entry_t *);
     47extern const char *smenu_entry_get_cmd(smenu_entry_t *);
    4848
    4949#endif
  • uspace/lib/tbarcfg/include/types/tbarcfg/tbarcfg.h

    r4030072 rb279899  
    2727 */
    2828
    29 /** @addtogroup libstartmenu
     29/** @addtogroup libtbarcfg
    3030 * @{
    3131 */
     
    3434 */
    3535
    36 #ifndef _STARTMENU_TYPES_STARTMENU_H
    37 #define _STARTMENU_TYPES_STARTMENU_H
     36#ifndef _TBARCFG_TYPES_TBARCFG_H
     37#define _TBARCFG_TYPES_TBARCFG_H
    3838
    39 struct startmenu;
    40 typedef struct startmenu startmenu_t;
     39struct tbarcfg;
     40typedef struct tbarcfg tbarcfg_t;
    4141
    42 struct startmenu_entry;
    43 typedef struct startmenu_entry startmenu_entry_t;
     42struct smenu_entry;
     43typedef struct smenu_entry smenu_entry_t;
    4444
    4545#endif
  • uspace/lib/tbarcfg/meson.build

    r4030072 rb279899  
    2929deps = [ 'sif' ]
    3030src = files(
    31         'src/startmenu.c',
     31        'src/tbarcfg.c',
    3232)
    3333
    3434test_src = files(
    3535        'test/main.c',
    36         'test/startmenu.c',
     36        'test/tbarcfg.c',
    3737)
  • uspace/lib/tbarcfg/private/tbarcfg.h

    r4030072 rb279899  
    2727 */
    2828
    29 /** @addtogroup libstartmenu
     29/** @addtogroup libtbarcfg
    3030 * @{
    3131 */
    3232/**
    33  * @file Start menu
     33 * @file Task bar configuration
    3434 *
    3535 */
    3636
    37 #ifndef _STARTMENU_PRIVATE_STARTMENU_H
    38 #define _STARTMENU_PRIVATE_STARTMENU_H
     37#ifndef _TBARCFG_PRIVATE_TBARCFG_H
     38#define _TBARCFG_PRIVATE_TBARCFG_H
    3939
    4040#include <adt/list.h>
    4141#include <sif.h>
    42 #include <types/startmenu/startmenu.h>
     42#include <types/tbarcfg/tbarcfg.h>
    4343
    44 /** Start menu */
    45 struct startmenu {
    46         /** List of entries (startmenu_entry_t) */
     44/** Task bar configuration */
     45struct tbarcfg {
     46        /** List of start menu entries (smenu_entry_t) */
    4747        list_t entries;
    4848};
    4949
    5050/** Start menu entry */
    51 struct startmenu_entry {
     51struct smenu_entry {
    5252        /** Containing start menu */
    53         struct startmenu *smenu;
     53        struct tbarcfg *smenu;
    5454        /** Link to @c smenu->entries */
    5555        link_t lentries;
     
    6060};
    6161
    62 extern errno_t startmenu_entry_create(startmenu_t *, const char *,
     62extern errno_t smenu_entry_create(tbarcfg_t *, const char *,
    6363    const char *);
    6464
  • uspace/lib/tbarcfg/src/tbarcfg.c

    r4030072 rb279899  
    2727 */
    2828
    29 /** @addtogroup libstartmenu
     29/** @addtogroup libtbarcfg
    3030 * @{
    3131 */
    3232/**
    33  * @file Start menu
     33 * @file Task bar configuration
    3434 */
    3535
    3636#include <errno.h>
    3737#include <sif.h>
    38 #include <startmenu/startmenu.h>
     38#include <tbarcfg/tbarcfg.h>
    3939#include <stdlib.h>
    4040#include <str.h>
    41 #include "../private/startmenu.h"
    42 
    43 /** Open start menu.
     41#include "../private/tbarcfg.h"
     42
     43/** Open task bar configuration.
    4444 *
    4545 * @param repopath Pathname of the menu repository
    46  * @param rsmenu Place to store pointer to start menu
     46 * @param rtbcfg Place to store pointer to task bar configuration
    4747 * @return EOK on success or an error code
    4848 */
    49 errno_t startmenu_open(const char *repopath, startmenu_t **rsmenu)
    50 {
    51         startmenu_t *smenu;
     49errno_t tbarcfg_open(const char *repopath, tbarcfg_t **rtbcfg)
     50{
     51        tbarcfg_t *tbcfg;
    5252        sif_sess_t *repo = NULL;
    5353        sif_node_t *rnode;
     
    5959        errno_t rc;
    6060
    61         smenu = calloc(1, sizeof(startmenu_t));
    62         if (smenu == NULL) {
    63                 rc = ENOMEM;
    64                 goto error;
    65         }
    66 
    67         list_initialize(&smenu->entries);
     61        tbcfg = calloc(1, sizeof(tbarcfg_t));
     62        if (tbcfg == NULL) {
     63                rc = ENOMEM;
     64                goto error;
     65        }
     66
     67        list_initialize(&tbcfg->entries);
    6868
    6969        rc = sif_open(repopath, &repo);
     
    9999                }
    100100
    101                 rc = startmenu_entry_create(smenu, caption, cmd);
     101                rc = smenu_entry_create(tbcfg, caption, cmd);
    102102                if (rc != EOK)
    103103                        goto error;
     
    106106        }
    107107
    108         *rsmenu = smenu;
     108        *rtbcfg = tbcfg;
    109109        return EOK;
    110110error:
    111111        if (repo != NULL)
    112112                sif_close(repo);
    113         if (smenu != NULL)
    114                 free(smenu);
     113        if (tbcfg != NULL)
     114                free(tbcfg);
    115115        return rc;
    116116}
    117117
    118 /** Close start menu.
    119  *
    120  * @param smenu Start menu
    121  */
    122 void startmenu_close(startmenu_t *smenu)
     118/** Close task bar configuration.
     119 *
     120 * @param tbcfg Start menu
     121 */
     122void tbarcfg_close(tbarcfg_t *tbcfg)
    123123{
    124124}
     
    126126/** Get first start menu entry.
    127127 *
    128  * @param smenu Start menu
     128 * @param tbcfg Task bar configuration
    129129 * @return First entry or @c NULL if the menu is empty
    130130 */
    131 startmenu_entry_t *startmenu_first(startmenu_t *smenu)
     131smenu_entry_t *tbarcfg_smenu_first(tbarcfg_t *tbcfg)
    132132{
    133133        link_t *link;
    134134
    135         link = list_first(&smenu->entries);
     135        link = list_first(&tbcfg->entries);
    136136        if (link == NULL)
    137137                return NULL;
    138138
    139         return list_get_instance(link, startmenu_entry_t, lentries);
     139        return list_get_instance(link, smenu_entry_t, lentries);
    140140}
    141141
     
    145145 * @return Next entry or @c NULL if @a cur is the last entry
    146146 */
    147 startmenu_entry_t *startmenu_next(startmenu_entry_t *cur)
     147smenu_entry_t *tbarcfg_smenu_next(smenu_entry_t *cur)
    148148{
    149149        link_t *link;
     
    153153                return NULL;
    154154
    155         return list_get_instance(link, startmenu_entry_t, lentries);
     155        return list_get_instance(link, smenu_entry_t, lentries);
    156156}
    157157
     
    161161 * @return Caption (with accelerator markup)
    162162 */
    163 const char *startmenu_entry_get_caption(startmenu_entry_t *entry)
     163const char *smenu_entry_get_caption(smenu_entry_t *entry)
    164164{
    165165        return entry->caption;
     
    171171 * @return Command to run
    172172 */
    173 const char *startmenu_entry_get_cmd(startmenu_entry_t *entry)
     173const char *smenu_entry_get_cmd(smenu_entry_t *entry)
    174174{
    175175        return entry->cmd;
     
    184184 * @param cmd Command to run
    185185 */
    186 errno_t startmenu_entry_create(startmenu_t *smenu, const char *caption,
     186errno_t smenu_entry_create(tbarcfg_t *smenu, const char *caption,
    187187    const char *cmd)
    188188{
    189         startmenu_entry_t *entry;
     189        smenu_entry_t *entry;
    190190        errno_t rc;
    191191
    192         entry = calloc(1, sizeof(startmenu_entry_t));
     192        entry = calloc(1, sizeof(smenu_entry_t));
    193193        if (entry == NULL) {
    194194                rc = ENOMEM;
  • uspace/lib/tbarcfg/test/main.c

    r4030072 rb279899  
    3131PCUT_INIT;
    3232
    33 PCUT_IMPORT(startmenu);
     33PCUT_IMPORT(tbarcfg);
    3434
    3535PCUT_MAIN();
  • uspace/lib/tbarcfg/test/tbarcfg.c

    r4030072 rb279899  
    2929#include <errno.h>
    3030#include <pcut/pcut.h>
    31 #include <startmenu/startmenu.h>
     31#include <tbarcfg/tbarcfg.h>
    3232#include <stdio.h>
    3333
    3434PCUT_INIT;
    3535
    36 PCUT_TEST_SUITE(startmenu);
     36PCUT_TEST_SUITE(tbarcfg);
    3737
    38 /** Opening and closing start menu */
     38/** Opening and closing task bar configuration */
    3939PCUT_TEST(open_close)
    4040{
    4141        errno_t rc;
    42         startmenu_t *smenu;
     42        tbarcfg_t *tbcfg;
    4343        FILE *f;
    4444        int rv;
     
    5353        PCUT_ASSERT_INT_EQUALS(0, rv);
    5454
    55         rc = startmenu_open("/tmp/test", &smenu);
     55        rc = tbarcfg_open("/tmp/test", &tbcfg);
    5656        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    5757
    58         startmenu_close(smenu);
     58        tbarcfg_close(tbcfg);
    5959}
    6060
     
    6363{
    6464        errno_t rc;
    65         startmenu_t *smenu;
    66         startmenu_entry_t *e;
     65        tbarcfg_t *tbcfg;
     66        smenu_entry_t *e;
    6767        FILE *f;
    6868        int rv;
     
    8080        PCUT_ASSERT_INT_EQUALS(0, rv);
    8181
    82         rc = startmenu_open("/tmp/test", &smenu);
     82        rc = tbarcfg_open("/tmp/test", &tbcfg);
    8383        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    8484
    85         e = startmenu_first(smenu);
     85        e = tbarcfg_smenu_first(tbcfg);
    8686        PCUT_ASSERT_NOT_NULL(e);
    87         e = startmenu_next(e);
     87        e = tbarcfg_smenu_next(e);
    8888        PCUT_ASSERT_NOT_NULL(e);
    89         e = startmenu_next(e);
     89        e = tbarcfg_smenu_next(e);
    9090        PCUT_ASSERT_NULL(e);
    9191
    92         startmenu_close(smenu);
     92        tbarcfg_close(tbcfg);
    9393}
    9494
     
    9797{
    9898        errno_t rc;
    99         startmenu_t *smenu;
    100         startmenu_entry_t *e;
     99        tbarcfg_t *tbcfg;
     100        smenu_entry_t *e;
    101101        const char *caption;
    102102        const char *cmd;
     
    115115        PCUT_ASSERT_INT_EQUALS(0, rv);
    116116
    117         rc = startmenu_open("/tmp/test", &smenu);
     117        rc = tbarcfg_open("/tmp/test", &tbcfg);
    118118        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    119119
    120         e = startmenu_first(smenu);
     120        e = tbarcfg_smenu_first(tbcfg);
    121121        PCUT_ASSERT_NOT_NULL(e);
    122122
    123         caption = startmenu_entry_get_caption(e);
     123        caption = smenu_entry_get_caption(e);
    124124        PCUT_ASSERT_STR_EQUALS("A", caption);
    125         cmd = startmenu_entry_get_cmd(e);
     125        cmd = smenu_entry_get_cmd(e);
    126126        PCUT_ASSERT_STR_EQUALS("a", cmd);
    127127
    128         startmenu_close(smenu);
     128        tbarcfg_close(tbcfg);
    129129}
    130130
    131 PCUT_EXPORT(startmenu);
     131PCUT_EXPORT(tbarcfg);
  • uspace/lib/ui/src/wdecor.c

    r4030072 rb279899  
    11121112        ui_wdecor_get_geom(wdecor, &geom);
    11131113
    1114         if ((wdecor->style & ui_wds_titlebar ) != 0 &&
     1114        if ((wdecor->style & ui_wds_titlebar) != 0 &&
    11151115            (wdecor->style & ui_wds_sysmenu_hdl) != 0) {
    11161116                if (event->type == POS_PRESS &&
Note: See TracChangeset for help on using the changeset viewer.