From 1b1cd2e11e5707e32abadc0833d87730929a45d3 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 20 Apr 2015 23:38:23 -0400 Subject: [PATCH] Changed the GTK+ backend menu code to honor what was just changed. --- unix/menu.c | 52 ++++++++++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/unix/menu.c b/unix/menu.c index 6e7b2743..3fc930ff 100644 --- a/unix/menu.c +++ b/unix/menu.c @@ -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;