forked from dorkbox/SystemTray
Fixed "Status" menu entries so they are consistent with all other
entries (in terms of x-platform/type)
This commit is contained in:
parent
2fdad344c1
commit
3673ed878c
@ -15,34 +15,30 @@
|
|||||||
*/
|
*/
|
||||||
package dorkbox.systemTray.linux;
|
package dorkbox.systemTray.linux;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import com.sun.jna.Pointer;
|
import com.sun.jna.Pointer;
|
||||||
|
|
||||||
import dorkbox.systemTray.MenuStatus;
|
|
||||||
import dorkbox.systemTray.SystemTrayMenuAction;
|
import dorkbox.systemTray.SystemTrayMenuAction;
|
||||||
import dorkbox.systemTray.linux.jna.Gobject;
|
import dorkbox.systemTray.linux.jna.Gobject;
|
||||||
import dorkbox.systemTray.linux.jna.Gtk;
|
import dorkbox.systemTray.linux.jna.Gtk;
|
||||||
|
|
||||||
class GtkMenuEntryStatus extends GtkMenuEntry implements MenuStatus {
|
// you might wonder WHY this extends MenuEntryItem -- the reason is that an AppIndicator "status" will be offset from everyone else,
|
||||||
|
// where a GtkStatusIndicator + SwingTray will have everything lined up. (with or without icons). This is to normalize how it looks
|
||||||
|
class GtkMenuEntryStatus extends GtkMenuEntryItem {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called from inside dispatch thread. ONLY creates the menu item, but DOES NOT attach it!
|
* 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
|
* this is a FLOATING reference. See: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#floating-ref
|
||||||
*/
|
*/
|
||||||
GtkMenuEntryStatus(final String label, final GtkTypeSystemTray parent) {
|
GtkMenuEntryStatus(final String label, final GtkTypeSystemTray parent) {
|
||||||
super(Gtk.gtk_menu_item_new_with_label(""), parent);
|
super(label, null, null, parent);
|
||||||
setText(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
void setSpacerImage(final boolean everyoneElseHasImages) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// called in the GTK thread
|
// called in the GTK thread
|
||||||
@Override
|
@Override
|
||||||
void renderText(final String text) {
|
void renderText(final String text) {
|
||||||
// evil hacks abound...
|
// evil hacks abound...
|
||||||
|
// https://developer.gnome.org/pango/stable/PangoMarkupFormat.html
|
||||||
|
|
||||||
Pointer label = Gtk.gtk_bin_get_child(menuItem);
|
Pointer label = Gtk.gtk_bin_get_child(menuItem);
|
||||||
Gtk.gtk_label_set_use_markup(label, Gtk.TRUE);
|
Gtk.gtk_label_set_use_markup(label, Gtk.TRUE);
|
||||||
Pointer markup = Gobject.g_markup_printf_escaped("<b>%s</b>", text);
|
Pointer markup = Gobject.g_markup_printf_escaped("<b>%s</b>", text);
|
||||||
@ -52,23 +48,8 @@ class GtkMenuEntryStatus extends GtkMenuEntry implements MenuStatus {
|
|||||||
Gtk.gtk_widget_set_sensitive(menuItem, Gtk.FALSE);
|
Gtk.gtk_widget_set_sensitive(menuItem, Gtk.FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
void setImage_(final File imageFile) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
void removePrivate() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public
|
|
||||||
boolean hasImage() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
void setCallback(final SystemTrayMenuAction callback) {
|
void setCallback(final SystemTrayMenuAction callback) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user