-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad25368
commit b00b102
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/gjs | ||
|
||
/* | ||
* This creates an appindicator which contains all common menu items | ||
* | ||
* Requires libappindicator3 introspection data | ||
*/ | ||
const Gtk = imports.gi.Gtk; | ||
const AppIndicator = imports.gi.AppIndicator3; | ||
const GLib = imports.gi.GLib; | ||
|
||
(function() { | ||
|
||
var app = new Gtk.Application({ | ||
application_id: null | ||
}); | ||
|
||
var window = null; | ||
|
||
app.connect("activate", function(){ | ||
window.present(); | ||
}); | ||
|
||
app.connect("startup", function() { | ||
window = new Gtk.ApplicationWindow({ | ||
title: "test", | ||
application: app | ||
}); | ||
|
||
var menu = new Gtk.Menu(); | ||
|
||
var item = Gtk.MenuItem.new_with_label("A standard item"); | ||
menu.append(item); | ||
|
||
item = Gtk.MenuItem.new_with_label("Foo"); | ||
menu.append(item); | ||
|
||
item = Gtk.ImageMenuItem.new_with_label("Calculator"); | ||
item.image = Gtk.Image.new_from_icon_name("gnome-calculator", Gtk.IconSize.MENU); | ||
menu.append(item); | ||
|
||
item = Gtk.CheckMenuItem.new_with_label("Check me!"); | ||
menu.append(item); | ||
|
||
item = new Gtk.SeparatorMenuItem(); | ||
menu.append(item); | ||
|
||
var group = []; | ||
|
||
for (let i = 0; i < 5; ++i) { | ||
item = Gtk.RadioMenuItem.new_with_label(group, "Example Radio "+i); | ||
group = Gtk.RadioMenuItem.prototype.get_group.apply(item)//.get_group(); | ||
if (i == 1) | ||
item.set_active(true); | ||
menu.append(item); | ||
} | ||
|
||
menu.show_all(); | ||
|
||
var indicator = AppIndicator.Indicator.new("Hello", "indicator-test", AppIndicator.IndicatorCategory.APPLICATION_STATUS); | ||
|
||
indicator.set_status(AppIndicator.IndicatorStatus.ACTIVE); | ||
indicator.set_icon("gnome-run"); | ||
indicator.set_menu(menu); | ||
}); | ||
app.run(ARGV); | ||
|
||
})(); |