Changed the GTK+ backend menu code to honor what was just changed.

This commit is contained in:
Pietro Gagliardi 2015-04-20 23:38:23 -04:00
parent a1e720bc05
commit 1b1cd2e11e
1 changed files with 24 additions and 28 deletions

View File

@ -10,33 +10,6 @@ static void appendMenuItem(GtkMenuShell *menu, const uiMenuItem *item)
{
GtkWidget *iw;
// TODO see if there are stock items for these three
if (item->Name == uiMenuItemQuit) {
// TODO verify type
appendSeparator(menu);
iw = gtk_menu_item_new_with_label("Quit");
gtk_menu_shell_append(menu, iw);
return;
}
if (item->Name == uiMenuItemPreferences) {
// TODO verify type
appendSeparator(menu);
iw = gtk_menu_item_new_with_label("Preferences");
gtk_menu_shell_append(menu, iw);
return;
}
if (item->Name == uiMenuItemAbout) {
// TODO verify type
appendSeparator(menu);
iw = gtk_menu_item_new_with_label("About");
gtk_menu_shell_append(menu, iw);
return;
}
if (item->Name == uiMenuItemSeparator) {
// TODO verify type
appendSeparator(menu);
return;
}
switch (item->Type) {
case uiMenuItemTypeCommand:
iw = gtk_menu_item_new_with_label(item->Name);
@ -46,6 +19,29 @@ static void appendMenuItem(GtkMenuShell *menu, const uiMenuItem *item)
iw = gtk_check_menu_item_new_with_label(item->Name);
gtk_menu_shell_append(menu, iw);
return;
// TODO see if there are stock items for these three
case uiMenuItemTypeQuit:
// TODO verify name
appendSeparator(menu);
iw = gtk_menu_item_new_with_label("Quit");
gtk_menu_shell_append(menu, iw);
return;
case uiMenuItemTypePreferences:
// TODO verify name
appendSeparator(menu);
iw = gtk_menu_item_new_with_label("Preferences");
gtk_menu_shell_append(menu, iw);
return;
case uiMenuItemTypeAbout:
// TODO verify name
appendSeparator(menu);
iw = gtk_menu_item_new_with_label("About");
gtk_menu_shell_append(menu, iw);
return;
case uiMenuItemTypeSeparator:
// TODO verify name
appendSeparator(menu);
return;
}
// TODO complain
}
@ -58,7 +54,7 @@ static GtkWidget *makeMenu(const char *name, uiMenuItem *items)
menu = gtk_menu_item_new_with_label(name);
submenu = gtk_menu_new();
for (i = items; i->Name != NULL; i++)
for (i = items; i->Type != 0; i++)
appendMenuItem(GTK_MENU_SHELL(submenu), i);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), submenu);
return menu;