Add onActivate and onDeactivate signals
This commit is contained in:
parent
acc5ef7f4f
commit
3b7247f97e
|
@ -59,6 +59,11 @@ extension emit one of the following signals :
|
||||||
* onDblClick
|
* onDblClick
|
||||||
* onRightDblClick
|
* onRightDblClick
|
||||||
|
|
||||||
|
Other signals are available when extension is activated/deactivated :
|
||||||
|
|
||||||
|
* onActivate
|
||||||
|
* onDeactivate
|
||||||
|
|
||||||
|
|
||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
|
|
7
dbus.xml
7
dbus.xml
|
@ -1,4 +1,5 @@
|
||||||
<interface name="com.soutade.GenericMonitor">
|
<interface name="com.soutade.GenericMonitor">
|
||||||
|
<!-- Functions -->
|
||||||
<method name="notify">
|
<method name="notify">
|
||||||
<arg type="s" direction="in" />
|
<arg type="s" direction="in" />
|
||||||
</method>
|
</method>
|
||||||
|
@ -8,6 +9,7 @@
|
||||||
<method name="deleteGroups">
|
<method name="deleteGroups">
|
||||||
<arg type="s" direction="in" />
|
<arg type="s" direction="in" />
|
||||||
</method>
|
</method>
|
||||||
|
<!-- Click events -->
|
||||||
<signal name="onClick">
|
<signal name="onClick">
|
||||||
<arg type="s" direction="out" />
|
<arg type="s" direction="out" />
|
||||||
</signal>
|
</signal>
|
||||||
|
@ -20,4 +22,9 @@
|
||||||
<signal name="onRightDblClick">
|
<signal name="onRightDblClick">
|
||||||
<arg type="s" direction="out" />
|
<arg type="s" direction="out" />
|
||||||
</signal>
|
</signal>
|
||||||
|
<!-- Activate/Deactivate signals -->
|
||||||
|
<signal name="onActivate">
|
||||||
|
</signal>
|
||||||
|
<signal name="onDectivate">
|
||||||
|
</signal>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
|
@ -49,7 +49,7 @@ class MonitorWidget {
|
||||||
|
|
||||||
// Don't know why, _rightBox seems undefined on shell 3.36 !!
|
// Don't know why, _rightBox seems undefined on shell 3.36 !!
|
||||||
if (this.box === undefined) {
|
if (this.box === undefined) {
|
||||||
log(`${box} is undefined, falling back to centerBox`);
|
log(`${box} box is undefined, falling back to center one`);
|
||||||
this.box = Main.panel._centerBox;
|
this.box = Main.panel._centerBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,6 @@ class MonitorWidget {
|
||||||
|
|
||||||
_addToBox(lastWidget) {
|
_addToBox(lastWidget) {
|
||||||
// lastWidget => NULL, insert at the end
|
// lastWidget => NULL, insert at the end
|
||||||
// Add to box
|
|
||||||
if (this.box !== Main.panel._rigthBox || lastWidget) {
|
if (this.box !== Main.panel._rigthBox || lastWidget) {
|
||||||
if (this.icon) {
|
if (this.icon) {
|
||||||
this.box.insert_child_above(this.icon, lastWidget);
|
this.box.insert_child_above(this.icon, lastWidget);
|
||||||
|
@ -177,6 +176,7 @@ class GenericMonitorDBUS {
|
||||||
this.clutterSettings = clutter.Settings.get_default();
|
this.clutterSettings = clutter.Settings.get_default();
|
||||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(loadInterfaceXml('dbus.xml'), this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(loadInterfaceXml('dbus.xml'), this);
|
||||||
this._dbusImpl.export(Gio.DBus.session, '/com/soutade/GenericMonitor');
|
this._dbusImpl.export(Gio.DBus.session, '/com/soutade/GenericMonitor');
|
||||||
|
this._dbusImpl.emit_signal('onActivate', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
_checkParmeters(parameters) {
|
_checkParmeters(parameters) {
|
||||||
|
@ -399,6 +399,7 @@ class GenericMonitorDBUS {
|
||||||
}
|
}
|
||||||
|
|
||||||
destructor() {
|
destructor() {
|
||||||
|
this._dbusImpl.emit_signal('onDeactivate', null);
|
||||||
for (let groupIndex in this.monitor_groups) {
|
for (let groupIndex in this.monitor_groups) {
|
||||||
let group = this.monitor_groups[groupIndex];
|
let group = this.monitor_groups[groupIndex];
|
||||||
for (let itemIndex in group)
|
for (let itemIndex in group)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user