Skip to content

Commit 2b61fb4

Browse files
committed
Put DBus interface in a file.
1 parent 95f06b0 commit 2b61fb4

File tree

4 files changed

+24
-16
lines changed

4 files changed

+24
-16
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ build:
5858
--extra-source ./logger.js \
5959
--extra-source ../ui \
6060
--extra-source ../src/effects \
61+
--extra-source ../dbus-interfaces \
6162
--schema ../schemas/org.gnome.shell.extensions.coverflowalttab.gschema.xml \
6263
--podir ../locale/ \
6364
-o ../build/
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
2+
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
3+
4+
5+
<node>
6+
<interface name="org.gnome.Shell.Extensions.Coverflowalttab">
7+
<method name="launch">
8+
<arg type="s" direction="in" name="type"/>
9+
</method>
10+
<method name="next"/>
11+
<method name="previous"/>
12+
<method name="select"/>
13+
</interface>
14+
</node>

src/extension.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ export default class CoverflowAltTabExtension extends Extension {
4848
this.manager = new Manager.Manager(
4949
new Platform.PlatformGnomeShell(this.getSettings(), this.logger),
5050
new Keybinder.Keybinder330Api(this.getSettings()),
51-
this.logger
51+
this
5252
);
5353
this.logger.log("Creating New Manager DONE");
54-
}
54+
}
5555
this.manager.enable();
5656
this.logger.decreaseIndent();
5757
this.logger.log("Enabling DONE");

src/manager.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,6 @@ import * as Main from 'resource:///org/gnome/shell/ui/main.js';
2525
import Gio from 'gi://Gio';
2626

2727

28-
const dBusInterfaceXml = `
29-
<node>
30-
<interface name="org.gnome.Shell.Extensions.Coverflowalttab">
31-
<method name="launch">
32-
<arg type="s" direction="in" name="type"/>
33-
</method>
34-
<method name="next"/>
35-
<method name="previous"/>
36-
<method name="select"/>
37-
</interface>
38-
</node>`;
39-
4028
function sortWindowsByUserTime(win1, win2) {
4129
let t1 = win1.get_user_time();
4230
let t2 = win2.get_user_time();
@@ -60,10 +48,11 @@ function matchOtherWorkspace(win) {
6048
}
6149

6250
export const Manager = class Manager {
63-
constructor(platform, keybinder, logger) {
51+
constructor(platform, keybinder, extensionObj) {
6452
this.platform = platform;
6553
this.keybinder = keybinder;
66-
this.logger = logger;
54+
this.extensionObj = extensionObj;
55+
this.logger = this.extensionObj.logger;
6756
this.switcher = null;
6857
this.exportedObject = null;
6958

@@ -107,10 +96,14 @@ export const Manager = class Manager {
10796
}
10897
this.keybinder.disable();
10998
this.platform.disable();
99+
this.logger = null;
100+
this.extensionObj = null;
110101
}
111102

112103
onBusAcquired(connection, name) {
113104
this.logger.log(`DBus Bus Acquired: ${name}`);
105+
const dBusInterfaceXml = new TextDecoder().decode(
106+
this.extensionObj.dir.get_child('dbus-interfaces').get_child('org.gnome.Shell.Extensions.Coverflowalttab.xml').load_contents(null)[1]);
114107
this.exportedObject = Gio.DBusExportedObject.wrapJSObject(dBusInterfaceXml, this);
115108
this.exportedObject.export(connection, '/org/gnome/Shell/Extensions/Coverflowalttab');
116109
}

0 commit comments

Comments
 (0)