Fixed errors with newer version of gnome where a sub-menu is added + shown BEFORE sub-menu entries are added to the sub-menu. Previously, this did not matter.

This commit is contained in:
nathan 2018-10-23 16:49:42 +02:00
parent 334dc1ec67
commit a1d4a6328a
2 changed files with 11 additions and 10 deletions

View File

@ -123,7 +123,7 @@ class GtkBaseMenuItem implements EntryPeer {
// will also get: gsignal.c:2516: signal 'child-added' is invalid for instance '0x7f1df8244080' of type 'GtkMenu'
Gtk2.gtk_menu_shell_append(parentNative, _native);
GObject.g_object_ref_sink(_native); // undoes "floating"
Gtk2.gtk_widget_show_all(_native); // necessary to guarantee widget is visible
// NOTE: We cannot show the menu until AFTER items have been added, otherwise we get GLIB warnings
}
@Override

View File

@ -109,14 +109,6 @@ class GtkMenu extends GtkBaseMenuItem implements MenuPeer {
if (parent != null) {
parent.deleteMenu();
}
// makes a new one
_nativeMenu = Gtk2.gtk_menu_new();
// binds sub-menu to entry (if it exists! it does not for the root menu)
if (parent != null) {
Gtk2.gtk_menu_item_set_submenu(_native, _nativeMenu);
}
}
/**
@ -133,6 +125,14 @@ class GtkMenu extends GtkBaseMenuItem implements MenuPeer {
return;
}
// makes a new one
_nativeMenu = Gtk2.gtk_menu_new();
// binds sub-menu to entry (if it exists! it does not for the root menu)
if (parent != null) {
Gtk2.gtk_menu_item_set_submenu(_native, _nativeMenu);
}
if (parent != null) {
parent.createMenu();
}
@ -160,7 +160,6 @@ class GtkMenu extends GtkBaseMenuItem implements MenuPeer {
}
onMenuAdded(_nativeMenu);
Gtk2.gtk_widget_show_all(_nativeMenu); // necessary to guarantee widget is visible (doesn't always show_all for all children)
}
/**
@ -250,6 +249,8 @@ class GtkMenu extends GtkBaseMenuItem implements MenuPeer {
else if (entry instanceof MenuItem) {
((MenuItem) entry).bind((GtkMenuItem) item, parentMenu, parentMenu.getSystemTray());
}
Gtk2.gtk_widget_show_all(_nativeMenu); // necessary to guarantee widget is visible (doesn't always show_all for all children)
}
});
}