{"action":"created","issue":{"url":"https://api.github.com/repos/andlabs/libui/issues/105","repository_url":"https://api.github.com/repos/andlabs/libui","labels_url":"https://api.github.com/repos/andlabs/libui/issues/105/labels{/name}","comments_url":"https://api.github.com/repos/andlabs/libui/issues/105/comments","events_url":"https://api.github.com/repos/andlabs/libui/issues/105/events","html_url":"https://github.com/andlabs/libui/issues/105","id":158440310,"number":105,"title":"add mnemonics to menus and menuitems","user":{"login":"aoloe","id":1857016,"avatar_url":"https://avatars.githubusercontent.com/u/1857016?v=3","gravatar_id":"","url":"https://api.github.com/users/aoloe","html_url":"https://github.com/aoloe","followers_url":"https://api.github.com/users/aoloe/followers","following_url":"https://api.github.com/users/aoloe/following{/other_user}","gists_url":"https://api.github.com/users/aoloe/gists{/gist_id}","starred_url":"https://api.github.com/users/aoloe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoloe/subscriptions","organizations_url":"https://api.github.com/users/aoloe/orgs","repos_url":"https://api.github.com/users/aoloe/repos","events_url":"https://api.github.com/users/aoloe/events{/privacy}","received_events_url":"https://api.github.com/users/aoloe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-06-03T19:41:58Z","updated_at":"2016-06-06T13:09:48Z","closed_at":null,"body":"in gtk, if you add a `_` in the menu item's label, you get an alt-shortcut to the menus.\r\n\r\nthis can be implemented as\r\n\r\n~~~.diff\r\ndiff --git a/unix/menu.c b/unix/menu.c\r\nindex 5ccb4a5..f7d06fc 100644\r\n--- a/unix/menu.c\r\n+++ b/unix/menu.c\r\n@@ -253,6 +253,7 @@ static void appendMenuItem(GtkMenuShell *submenu, uiMenuItem *item, uiWindow *w)\r\n        menuitem = g_object_new(item->gtype, NULL);\r\n        if (item->name != NULL)\r\n                gtk_menu_item_set_label(GTK_MENU_ITEM(menuitem), item->name);\r\n+               gtk_menu_item_set_use_underline(GTK_MENU_ITEM(menuitem), TRUE);\r\n        if (item->type != typeSeparator) {\r\n                signal = g_signal_connect(menuitem, \"activate\", G_CALLBACK(onClicked), item);\r\n                gtk_widget_set_sensitive(menuitem, !item->disabled);\r\n@@ -281,7 +282,7 @@ GtkWidget *makeMenubar(uiWindow *w)\r\n        if (menus != NULL)\r\n                for (i = 0; i < menus->len; i++) {\r\n                        m = g_array_index(menus, uiMenu *, i);\r\n-                       menuitem = gtk_menu_item_new_with_label(m->name);\r\n+                       menuitem = gtk_menu_item_new_with_mnemonic(m->name);\r\n                        submenu = gtk_menu_new();\r\n                        gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);\r\n                        for (j = 0; j < m->items->len; j++)\r\n~~~\r\n\r\ni'm not doing a pull request yet,\r\n- since i have no idea how to implement on mac and windows\r\n- i wonder if there would be any reason to make it optional instead of automatic\r\n- gtk is using the `_` character, qt `&` and libui should choose one (and convert to the others)\r\n\r\nonce the two questions are answered i'm ready to make a pull request..."},"comment":{"url":"https://api.github.com/repos/andlabs/libui/issues/comments/223953787","html_url":"https://github.com/andlabs/libui/issues/105#issuecomment-223953787","issue_url":"https://api.github.com/repos/andlabs/libui/issues/105","id":223953787,"user":{"login":"aoloe","id":1857016,"avatar_url":"https://avatars.githubusercontent.com/u/1857016?v=3","gravatar_id":"","url":"https://api.github.com/users/aoloe","html_url":"https://github.com/aoloe","followers_url":"https://api.github.com/users/aoloe/followers","following_url":"https://api.github.com/users/aoloe/following{/other_user}","gists_url":"https://api.github.com/users/aoloe/gists{/gist_id}","starred_url":"https://api.github.com/users/aoloe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoloe/subscriptions","organizations_url":"https://api.github.com/users/aoloe/orgs","repos_url":"https://api.github.com/users/aoloe/repos","events_url":"https://api.github.com/users/aoloe/events{/privacy}","received_events_url":"https://api.github.com/users/aoloe/received_events","type":"User","site_admin":false},"created_at":"2016-06-06T13:09:47Z","updated_at":"2016-06-06T13:09:47Z","body":"@andlabs , i don't think accepting both is a good idea.\r\n\r\nand i don't think that forbidding the use of & in menu entries is a good idea (well, _ should not be in a menu, but you never know what people want to put in there...)\r\n(my firefox on mac has one such entry... not the most useful one, but there is one... :-)"}}
{"actor":{"display_login":"aoloe"}}