1
0
forked from Yadciel/c_tray

added submenu

This commit is contained in:
angelskieglazki
2017-01-10 17:47:28 +03:00
parent 19d958a831
commit a09222db55
2 changed files with 52 additions and 25 deletions

View File

@@ -39,15 +39,23 @@ static void quit_cb(struct tray_menu *item) {
tray_exit();
}
static void submenu_cb(struct tray_submenu *item) {
(void)item;
printf("submenu cb\n");
tray_update(&tray);
}
//struct tray_submenu *t_sm = (struct tray_submenu[]){{"First",submenu_cb}, {"Second",submenu_cb}, {NULL, NULL},};
static struct tray tray = {
.icon = TRAY_ICON1,
.menu = (struct tray_menu[]){{"Hello", 0, 0, hello_cb, NULL},
{"Checked", 0, 1, toggle_cb, NULL},
{"Disabled", 1, 0, NULL, NULL},
{"-", 0, 0, NULL, NULL},
{"+", 0, 0, NULL, NULL},
{"Quit", 0, 0, quit_cb, NULL},
{NULL, 0, 0, NULL, NULL}},
.menu = (struct tray_menu[]){{"Hello", 0, 0, NULL, hello_cb, NULL},
{"Checked", 0, 1, NULL, toggle_cb, NULL},
{"Disabled", 1, 0, NULL, NULL, NULL},
{"-", 0, 0, NULL, NULL, NULL},
{"SubMenu", 0, 0, (struct tray_submenu[]){{"First",submenu_cb, NULL}, {"Second",submenu_cb, NULL}, {NULL, NULL, NULL},}, NULL, NULL},
{"Quit", 0, 0, NULL, quit_cb, NULL},
{NULL, 0, 0, NULL, NULL, NULL}},
};
int main() {