From 461243c902b3c1cbcc26c9412f3b5a98ddc1a0d5 Mon Sep 17 00:00:00 2001 From: "pavlov%pavlov.net" Date: Sun, 8 Nov 1998 02:05:02 +0000 Subject: [PATCH] fix menu code... submenus are not added correctly for some reason, but the earlier warnings are gone. --- widget/src/gtk/nsMenu.cpp | 14 +++++++++----- widget/src/gtk/nsPopUpMenu.cpp | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/widget/src/gtk/nsMenu.cpp b/widget/src/gtk/nsMenu.cpp index d162b2e9d51e..e21bae0e3462 100644 --- a/widget/src/gtk/nsMenu.cpp +++ b/widget/src/gtk/nsMenu.cpp @@ -127,7 +127,8 @@ NS_METHOD nsMenu::AddItem(const nsString &aText) GtkWidget *widget; widget = gtk_menu_item_new_with_label (labelStr); - gtk_menu_append (GTK_MENU (mMenu), widget); +// gtk_menu_append (GTK_MENU (mMenu), widget); + gtk_menu_shell_append (GTK_MENU_SHELL (mMenu), widget); delete[] labelStr; @@ -143,7 +144,7 @@ NS_METHOD nsMenu::AddItem(nsIMenuItem * aMenuItem) aMenuItem->GetNativeData(voidData); widget = GTK_WIDGET(voidData); - gtk_menu_append (GTK_MENU (mMenu), widget); + gtk_menu_shell_append (GTK_MENU_SHELL (mMenu), widget); // XXX add aMenuItem to internal data structor list return NS_OK; @@ -163,13 +164,16 @@ NS_METHOD nsMenu::AddMenu(nsIMenu * aMenu) labelStr = Label.ToNewCString(); - parentmenu = GetNativeParent(); + aMenu->GetNativeData(voidData); + parentmenu = GTK_WIDGET(voidData); item = gtk_menu_item_new_with_label (labelStr); - gtk_menu_append (GTK_MENU (parentmenu), item); + gtk_menu_shell_append (GTK_MENU_SHELL (parentmenu), item); delete[] labelStr; + voidData = NULL; + aMenu->GetNativeData(voidData); newmenu = GTK_WIDGET(voidData); @@ -185,7 +189,7 @@ NS_METHOD nsMenu::AddSeparator() { GtkWidget *widget; widget = gtk_menu_item_new (); - gtk_menu_append (GTK_MENU (mMenu), widget); + gtk_menu_shell_append (GTK_MENU_SHELL (mMenu), widget); return NS_OK; } diff --git a/widget/src/gtk/nsPopUpMenu.cpp b/widget/src/gtk/nsPopUpMenu.cpp index f501be5b03c2..9a2a2b19cd96 100644 --- a/widget/src/gtk/nsPopUpMenu.cpp +++ b/widget/src/gtk/nsPopUpMenu.cpp @@ -92,7 +92,7 @@ NS_METHOD nsPopUpMenu::AddSeparator() { GtkWidget *widget; widget = gtk_menu_item_new (); - gtk_menu_append (GTK_MENU (mMenu), widget); + gtk_menu_shell_append (GTK_MENU_SHELL (mMenu), widget); #if 0 Widget widget = XtVaCreateManagedWidget("__sep", xmSeparatorGadgetClass, mMenu,