diff --git a/dbus.go b/dbus.go
index d583fe2..abcd23b 100644
--- a/dbus.go
+++ b/dbus.go
@@ -15,6 +15,9 @@ const introspectXml = `
+
+
+
` +
introspect.IntrospectDataString +
``
@@ -85,9 +88,15 @@ func (ds *dbusServer) Introspect(msg dbus.Message) (string, *dbus.Error) {
}
func (ds *dbusServer) SetEnabled(flag bool) *dbus.Error {
+ log.Info("SetEnabled(%v) called", flag)
return nil
}
+func (ds *dbusServer) IsEnabled() (bool, *dbus.Error) {
+ log.Info("IsEnabled() called")
+ return true, nil
+}
+
func (ds *dbusServer) prompt(p *Policy) {
log.Info("prompting...")
ds.prompter.prompt(p)
diff --git a/gnome-shell/firewall@subgraph.com/menu.js b/gnome-shell/firewall@subgraph.com/menu.js
index a16745d..8a49bef 100644
--- a/gnome-shell/firewall@subgraph.com/menu.js
+++ b/gnome-shell/firewall@subgraph.com/menu.js
@@ -1,18 +1,46 @@
const Lang = imports.lang;
+const Gio = imports.gi.Gio;
const Main = imports.ui.main;
const PopupMenu = imports.ui.popupMenu;
+const FirewallInterface = ' \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+\
+';
+
+const FirewallProxy = Gio.DBusProxy.makeProxyWrapper(FirewallInterface);
const FirewallMenu = new Lang.Class({
Name: 'FirewallSupport',
_init: function() {
+ this.proxy = new FirewallProxy(Gio.DBus.system, "com.subgraph.Firewall",
+ "/com/subgraph/Firewall", Lang.bind(this, function(proxy, error) {
+ if(error) {
+ log(error.message);
+ return;
+ }
+ }));
this.aggregate = Main.panel.statusArea.aggregateMenu;
},
install: function() {
this.createMenu();
+ this.proxy.IsEnabledRemote(Lang.bind(this, function(result, err) {
+ if(err) {
+ log(err.message);
+ return;
+ }
+ let [enabled] = result;
+ this.toggle.setToggleState(enabled);
+ }));
let idx = this.findMenu(this.aggregate._power.menu);
if(idx >= 0) {
this.aggregate.menu.addMenuItem(this.menu, idx);
@@ -43,7 +71,7 @@ const FirewallMenu = new Lang.Class({
this.menu = new PopupMenu.PopupMenuSection();
this.item = new PopupMenu.PopupSubMenuMenuItem("Firewall", true);
this.item.icon.icon_name = "security-high-symbolic";
- this.toggle = new PopupMenu.PopupSwitchMenuItem("Firewall Enabled", false);
+ this.toggle = new PopupMenu.PopupSwitchMenuItem("Firewall Enabled", true);
this.toggle.connect('toggled', Lang.bind(this, this.onToggle));
this.item.menu.addMenuItem(this.toggle);
@@ -58,6 +86,7 @@ const FirewallMenu = new Lang.Class({
} else {
log("Toggle OFF");
}
+ this.proxy.SetEnabledRemote(this.toggle.state);
},
onSettings: function() {