forked from dorkbox/SystemTray
Code polish
This commit is contained in:
parent
bf3cb8de11
commit
8d564675f8
@ -183,13 +183,16 @@ class GtkMenu extends Menu {
|
||||
// To work around this issue, we destroy then recreate the menu every time something is changed.
|
||||
deleteMenu();
|
||||
|
||||
menuEntry = new GtkMenuEntryItem(GtkMenu.this, menuText, imagePath, callback);
|
||||
menuEntry = new GtkMenuEntryItem(GtkMenu.this, callback);
|
||||
menuEntry.setText(menuText);
|
||||
menuEntry.setImage(imagePath);
|
||||
menuEntries.add(menuEntry);
|
||||
|
||||
if (menuText.equals("AAAAAAAA")) {
|
||||
// GtkMenu subMenu = new GtkMenu();
|
||||
// subMenu.addMenuEntry("asdasdasd", null, null, null);
|
||||
// Gtk.gtk_menu_item_set_submenu(((GtkMenuEntryItem) menuEntry).nativeMenuItem, subMenu.nativeMenu);
|
||||
Gtk.gtk_widget_set_sensitive(((GtkMenuEntryItem) menuEntry)._native, Gtk.TRUE);
|
||||
GtkMenu subMenu = new GtkMenu(getSystemTray(), GtkMenu.this);
|
||||
subMenu.addMenuEntry("asdasdasd", null, null, null);
|
||||
Gtk.gtk_menu_item_set_submenu(((GtkMenuEntryItem) menuEntry)._native, subMenu._native);
|
||||
}
|
||||
|
||||
createMenu();
|
||||
|
@ -43,17 +43,15 @@ class GtkMenuEntryItem extends GtkMenuEntry implements GCallback {
|
||||
* called from inside dispatch thread. ONLY creates the menu item, but DOES NOT attach it!
|
||||
* this is a FLOATING reference. See: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#floating-ref
|
||||
*/
|
||||
GtkMenuEntryItem(final GtkMenu parentMenu, final String label, final File image, final SystemTrayMenuAction callback) {
|
||||
GtkMenuEntryItem(final GtkMenu parentMenu, final SystemTrayMenuAction callback) {
|
||||
super(parentMenu, Gtk.gtk_image_menu_item_new_with_label(""));
|
||||
this.callback = callback;
|
||||
setText(label);
|
||||
|
||||
|
||||
if (transparentIcon == null) {
|
||||
transparentIcon = ImageUtils.getTransparentImage(ImageUtils.ENTRY_SIZE);
|
||||
}
|
||||
|
||||
setImage_(image);
|
||||
|
||||
if (callback != null) {
|
||||
Gtk.gtk_widget_set_sensitive(_native, Gtk.TRUE);
|
||||
nativeLong = Gobject.g_signal_connect_object(_native, "activate", this, null, 0);
|
||||
|
@ -29,8 +29,9 @@ class GtkMenuEntryStatus extends GtkMenuEntryItem {
|
||||
* called from inside dispatch thread. ONLY creates the menu item, but DOES NOT attach it!
|
||||
* this is a FLOATING reference. See: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#floating-ref
|
||||
*/
|
||||
GtkMenuEntryStatus(final GtkMenu parentMenu, final String label) {
|
||||
super(parentMenu, label, null, null);
|
||||
GtkMenuEntryStatus(final GtkMenu parentMenu, final String text) {
|
||||
super(parentMenu, null);
|
||||
setText(text);
|
||||
}
|
||||
|
||||
// called in the GTK thread
|
||||
|
Loading…
Reference in New Issue
Block a user