forked from awamper/everpad-integration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbus.js
217 lines (180 loc) · 5.54 KB
/
dbus.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
const Gio = imports.gi.Gio;
const DBusIface =
<interface name="org.freedesktop.DBus">
<method name="GetNameOwner">
<arg type="s" direction="in" />
<arg type="s" direction="out" />
</method>
<method name="ListNames">
<arg type="as" direction="out" />
</method>
<signal name="NameOwnerChanged">
<arg type="s" direction="out" />
<arg type="s" direction="out" />
<arg type="s" direction="out" />
</signal>
</interface>;
const DBusProxy = Gio.DBusProxy.makeProxyWrapper(DBusIface);
const EverpadProviderDBusIface =
<interface name="com.everpad.Provider">
<method name="list_tags">
<arg type="a" direction="out" />
</method>
<method name="list_notebooks">
<arg type="a" direction="out" />
</method>
<method name="find_notes">
<arg type="s" direction="in" />
<arg type="ai" direction="in" />
<arg type="ai" direction="in" />
<arg type="i" direction="in" />
<arg type="i" direction="in" />
<arg type="i" direction="in" />
<arg type="i" direction="in" />
<arg type="a(issxxiassbiaixs)" direction="out" />
</method>
<method name="get_notebook">
<arg type="i" direction="in" />
<arg type="(isis)" direction="out" />
</method>
<method name="update_note">
<arg type="(issxxiassbiaixs)" direction="in" />
<arg type="(issxxiassbiaixs)" direction="out" />
</method>
<method name="share_note">
<arg type="i" direction="in" />
</method>
<method name="stop_sharing_note">
<arg type="i" direction="in" />
</method>
<method name="delete_note">
<arg type="i" direction="in" />
<arg type="b" direction="out" />
</method>
<method name="get_note_resources">
<arg type="i" direction="in" />
<arg type="a(issss)" direction="out" />
</method>
<method name="get_status">
<arg type="i" direction="out" />
</method>
<method name="get_last_sync">
<arg type="s" direction="out" />
</method>
<method name="is_first_synced">
<arg type="b" direction="out" />
</method>
<method name="is_authenticated">
<arg type="b" direction="out" />
</method>
<method name="sync" />
<method name="kill" />
</interface>;
const EverpadProviderProxy = Gio.DBusProxy.makeProxyWrapper(
EverpadProviderDBusIface
);
const EverpadProviderSignalsDBusIface =
<interface name="com.everpad.provider">
<signal name="sync_state_changed">
<arg type="i" direction="out" />
</signal>
<signal name="data_changed" />
</interface>;
const EverpadProviderSignalsProxy = Gio.DBusProxy.makeProxyWrapper(
EverpadProviderSignalsDBusIface
);
const EverpadAppDBusIface =
<interface name="com.everpad.App">
<method name="all_notes" />
<method name="kill" />
<method name="settings" />
<method name="create" />
<method name="open">
<arg type="i" direction="in" />
</method>
<method name="open_with_search_term">
<arg type="i" direction="in" />
<arg type="s" direction="in" />
</method>
</interface>;
const EverpadAppProxy = Gio.DBusProxy.makeProxyWrapper(
EverpadAppDBusIface
);
function dbus_control() {
let r = new DBusProxy(
Gio.DBus.session,
'org.freedesktop.DBus',
'/org/freedesktop/DBus'
);
return r;
}
function everpad_provider_control() {
let r = new EverpadProviderProxy(
Gio.DBus.session,
'com.everpad.Provider',
'/EverpadProvider'
);
return r;
}
function everpad_provider_signals() {
let r = new EverpadProviderSignalsProxy(
Gio.DBus.session,
'com.everpad.Provider',
'/EverpadProvider'
);
return r;
}
function everpad_app_control() {
let r = new EverpadAppProxy(
Gio.DBus.session,
'com.everpad.App',
'/EverpadService'
);
return r;
}
function get_dbus_control() {
if(DBUS_CONTROL === null) {
DBUS_CONTROL = dbus_control();
}
return DBUS_CONTROL;
}
function get_everpad_provider() {
if(EVERPAD_PROVIDER === null) {
EVERPAD_PROVIDER = everpad_provider_control();
}
return EVERPAD_PROVIDER;
}
function get_everpad_provider_signals() {
if(EVERPAD_PROVIDER_SIGNALS === null) {
EVERPAD_PROVIDER_SIGNALS = everpad_provider_signals();
}
return EVERPAD_PROVIDER_SIGNALS;
}
function get_everpad_app() {
if(EVERPAD_APP === null) {
EVERPAD_APP = everpad_app_control();
}
return EVERPAD_APP;
}
function destroy_dbus_proxies() {
if(DBUS_CONTROL != null) {
DBUS_CONTROL.run_dispose();
DBUS_CONTROL = null;
}
if(EVERPAD_APP != null) {
EVERPAD_APP.run_dispose();
EVERPAD_APP = null;
}
if(EVERPAD_PROVIDER != null) {
EVERPAD_PROVIDER.run_dispose();
EVERPAD_PROVIDER = null;
}
if(EVERPAD_PROVIDER_SIGNALS != null) {
EVERPAD_PROVIDER_SIGNALS.run_dispose();
EVERPAD_PROVIDER_SIGNALS = null;
}
}
let EVERPAD_PROVIDER = null;
let EVERPAD_APP = null;
let EVERPAD_PROVIDER_SIGNALS = null;
let DBUS_CONTROL = null;//dbus_control();