* Update readme.

* updates

* Update and fix startup issues.
This commit is contained in:
Jas Singh
2024-12-20 22:40:41 -08:00
committed by GitHub
parent 0101f242e6
commit e4a5e8060e
4 changed files with 70 additions and 173 deletions

View File

@@ -33,7 +33,16 @@ const MenuDefaultIcon = ({ item }: MenuEntryProps): JSX.Element => {
};
const MenuEntry = ({ item, child }: MenuEntryProps): JSX.Element => {
const menu = createMenu(item.menuModel, item.actionGroup);
let menu: Gtk.Menu;
const entryBinding = Variable.derive(
[bind(item, 'menuModel'), bind(item, 'actionGroup')],
(menuModel, actionGroup) => {
if (menuModel && actionGroup) {
menu = createMenu(menuModel, actionGroup);
}
},
);
return (
<button
@@ -51,7 +60,10 @@ const MenuEntry = ({ item, child }: MenuEntryProps): JSX.Element => {
Notify({ summary: 'App Name', body: item.id });
}
}}
onDestroy={() => menu?.destroy()}
onDestroy={() => {
menu?.destroy();
entryBinding.drop();
}}
>
{child}
</button>