Browse code

style: Automatically format source on commit

Payson Wallach authored on 11/06/2020 05:11:02
Showing 79 changed files

1 1
new file mode 100644
... ...
@@ -0,0 +1,12 @@
1
+root = true
2
+
3
+[*]
4
+indent_style = space
5
+indent_size = 2
6
+end_of_line = lf
7
+charset = utf-8
8
+trim_trailing_whitespace = true
9
+insert_final_newline = true
10
+
11
+[{*.vala,*.vapi}]
12
+indent_size = 4
0 13
new file mode 100644
... ...
@@ -0,0 +1 @@
1
+* text=auto
... ...
@@ -61,3 +61,5 @@ debian/synapse.substvars
61 61
 debian/synapse
62 62
 *.swp
63 63
 debian/debhelper-build-stamp
64
+*.uncrustify
65
+node_modules/
64 66
new file mode 100644
... ...
@@ -0,0 +1 @@
1
+module.exports = { extends: ["@commitlint/config-conventional"] };
0 2
new file mode 100644
... ...
@@ -0,0 +1,343 @@
1
+{
2
+  "name": "synapse",
3
+  "version": "0.4.7",
4
+  "lockfileVersion": 1,
5
+  "requires": true,
6
+  "dependencies": {
7
+    "@babel/code-frame": {
8
+      "version": "7.10.1",
9
+      "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.1.tgz",
10
+      "integrity": "sha512-IGhtTmpjGbYzcEDOw7DcQtbQSXcG9ftmAXtWTu9V936vDye4xjjekktFAtgZsWpzTj/X01jocB46mTywm/4SZw==",
11
+      "requires": {
12
+        "@babel/highlight": "^7.10.1"
13
+      }
14
+    },
15
+    "@babel/helper-validator-identifier": {
16
+      "version": "7.10.1",
17
+      "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.1.tgz",
18
+      "integrity": "sha512-5vW/JXLALhczRCWP0PnFDMCJAchlBvM7f4uk/jXritBnIa6E1KmqmtrS3yn1LAnxFBypQ3eneLuXjsnfQsgILw=="
19
+    },
20
+    "@babel/highlight": {
21
+      "version": "7.10.1",
22
+      "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.1.tgz",
23
+      "integrity": "sha512-8rMof+gVP8mxYZApLF/JgNDAkdKa+aJt3ZYxF8z6+j/hpeXL7iMsKCPHa2jNMHu/qqBwzQF4OHNoYi8dMA/rYg==",
24
+      "requires": {
25
+        "@babel/helper-validator-identifier": "^7.10.1",
26
+        "chalk": "^2.0.0",
27
+        "js-tokens": "^4.0.0"
28
+      },
29
+      "dependencies": {
30
+        "ansi-styles": {
31
+          "version": "3.2.1",
32
+          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
33
+          "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
34
+          "requires": {
35
+            "color-convert": "^1.9.0"
36
+          }
37
+        },
38
+        "chalk": {
39
+          "version": "2.4.2",
40
+          "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
41
+          "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
42
+          "requires": {
43
+            "ansi-styles": "^3.2.1",
44
+            "escape-string-regexp": "^1.0.5",
45
+            "supports-color": "^5.3.0"
46
+          }
47
+        },
48
+        "color-convert": {
49
+          "version": "1.9.3",
50
+          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
51
+          "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
52
+          "requires": {
53
+            "color-name": "1.1.3"
54
+          }
55
+        },
56
+        "color-name": {
57
+          "version": "1.1.3",
58
+          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
59
+          "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
60
+        },
61
+        "has-flag": {
62
+          "version": "3.0.0",
63
+          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
64
+          "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
65
+        },
66
+        "supports-color": {
67
+          "version": "5.5.0",
68
+          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
69
+          "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
70
+          "requires": {
71
+            "has-flag": "^3.0.0"
72
+          }
73
+        }
74
+      }
75
+    },
76
+    "@types/color-name": {
77
+      "version": "1.1.1",
78
+      "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
79
+      "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ=="
80
+    },
81
+    "@types/parse-json": {
82
+      "version": "4.0.0",
83
+      "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz",
84
+      "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA=="
85
+    },
86
+    "ansi-styles": {
87
+      "version": "4.2.1",
88
+      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
89
+      "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
90
+      "requires": {
91
+        "@types/color-name": "^1.1.1",
92
+        "color-convert": "^2.0.1"
93
+      }
94
+    },
95
+    "callsites": {
96
+      "version": "3.1.0",
97
+      "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
98
+      "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="
99
+    },
100
+    "chalk": {
101
+      "version": "4.1.0",
102
+      "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
103
+      "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
104
+      "requires": {
105
+        "ansi-styles": "^4.1.0",
106
+        "supports-color": "^7.1.0"
107
+      }
108
+    },
109
+    "ci-info": {
110
+      "version": "2.0.0",
111
+      "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
112
+      "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ=="
113
+    },
114
+    "color-convert": {
115
+      "version": "2.0.1",
116
+      "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
117
+      "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
118
+      "requires": {
119
+        "color-name": "~1.1.4"
120
+      }
121
+    },
122
+    "color-name": {
123
+      "version": "1.1.4",
124
+      "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
125
+      "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
126
+    },
127
+    "compare-versions": {
128
+      "version": "3.6.0",
129
+      "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz",
130
+      "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA=="
131
+    },
132
+    "cosmiconfig": {
133
+      "version": "6.0.0",
134
+      "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz",
135
+      "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==",
136
+      "requires": {
137
+        "@types/parse-json": "^4.0.0",
138
+        "import-fresh": "^3.1.0",
139
+        "parse-json": "^5.0.0",
140
+        "path-type": "^4.0.0",
141
+        "yaml": "^1.7.2"
142
+      }
143
+    },
144
+    "error-ex": {
145
+      "version": "1.3.2",
146
+      "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
147
+      "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
148
+      "requires": {
149
+        "is-arrayish": "^0.2.1"
150
+      }
151
+    },
152
+    "escape-string-regexp": {
153
+      "version": "1.0.5",
154
+      "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
155
+      "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
156
+    },
157
+    "find-up": {
158
+      "version": "4.1.0",
159
+      "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
160
+      "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
161
+      "requires": {
162
+        "locate-path": "^5.0.0",
163
+        "path-exists": "^4.0.0"
164
+      }
165
+    },
166
+    "find-versions": {
167
+      "version": "3.2.0",
168
+      "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-3.2.0.tgz",
169
+      "integrity": "sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww==",
170
+      "requires": {
171
+        "semver-regex": "^2.0.0"
172
+      }
173
+    },
174
+    "has-flag": {
175
+      "version": "4.0.0",
176
+      "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
177
+      "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
178
+    },
179
+    "husky": {
180
+      "version": "4.2.5",
181
+      "resolved": "https://registry.npmjs.org/husky/-/husky-4.2.5.tgz",
182
+      "integrity": "sha512-SYZ95AjKcX7goYVZtVZF2i6XiZcHknw50iXvY7b0MiGoj5RwdgRQNEHdb+gPDPCXKlzwrybjFjkL6FOj8uRhZQ==",
183
+      "requires": {
184
+        "chalk": "^4.0.0",
185
+        "ci-info": "^2.0.0",
186
+        "compare-versions": "^3.6.0",
187
+        "cosmiconfig": "^6.0.0",
188
+        "find-versions": "^3.2.0",
189
+        "opencollective-postinstall": "^2.0.2",
190
+        "pkg-dir": "^4.2.0",
191
+        "please-upgrade-node": "^3.2.0",
192
+        "slash": "^3.0.0",
193
+        "which-pm-runs": "^1.0.0"
194
+      }
195
+    },
196
+    "import-fresh": {
197
+      "version": "3.2.1",
198
+      "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz",
199
+      "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==",
200
+      "requires": {
201
+        "parent-module": "^1.0.0",
202
+        "resolve-from": "^4.0.0"
203
+      }
204
+    },
205
+    "is-arrayish": {
206
+      "version": "0.2.1",
207
+      "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
208
+      "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0="
209
+    },
210
+    "js-tokens": {
211
+      "version": "4.0.0",
212
+      "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
213
+      "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
214
+    },
215
+    "json-parse-better-errors": {
216
+      "version": "1.0.2",
217
+      "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
218
+      "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw=="
219
+    },
220
+    "lines-and-columns": {
221
+      "version": "1.1.6",
222
+      "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
223
+      "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA="
224
+    },
225
+    "locate-path": {
226
+      "version": "5.0.0",
227
+      "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
228
+      "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
229
+      "requires": {
230
+        "p-locate": "^4.1.0"
231
+      }
232
+    },
233
+    "opencollective-postinstall": {
234
+      "version": "2.0.3",
235
+      "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz",
236
+      "integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q=="
237
+    },
238
+    "p-limit": {
239
+      "version": "2.3.0",
240
+      "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
241
+      "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
242
+      "requires": {
243
+        "p-try": "^2.0.0"
244
+      }
245
+    },
246
+    "p-locate": {
247
+      "version": "4.1.0",
248
+      "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
249
+      "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
250
+      "requires": {
251
+        "p-limit": "^2.2.0"
252
+      }
253
+    },
254
+    "p-try": {
255
+      "version": "2.2.0",
256
+      "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
257
+      "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
258
+    },
259
+    "parent-module": {
260
+      "version": "1.0.1",
261
+      "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
262
+      "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
263
+      "requires": {
264
+        "callsites": "^3.0.0"
265
+      }
266
+    },
267
+    "parse-json": {
268
+      "version": "5.0.0",
269
+      "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz",
270
+      "integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==",
271
+      "requires": {
272
+        "@babel/code-frame": "^7.0.0",
273
+        "error-ex": "^1.3.1",
274
+        "json-parse-better-errors": "^1.0.1",
275
+        "lines-and-columns": "^1.1.6"
276
+      }
277
+    },
278
+    "path-exists": {
279
+      "version": "4.0.0",
280
+      "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
281
+      "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="
282
+    },
283
+    "path-type": {
284
+      "version": "4.0.0",
285
+      "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
286
+      "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw=="
287
+    },
288
+    "pkg-dir": {
289
+      "version": "4.2.0",
290
+      "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz",
291
+      "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==",
292
+      "requires": {
293
+        "find-up": "^4.0.0"
294
+      }
295
+    },
296
+    "please-upgrade-node": {
297
+      "version": "3.2.0",
298
+      "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz",
299
+      "integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==",
300
+      "requires": {
301
+        "semver-compare": "^1.0.0"
302
+      }
303
+    },
304
+    "resolve-from": {
305
+      "version": "4.0.0",
306
+      "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
307
+      "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="
308
+    },
309
+    "semver-compare": {
310
+      "version": "1.0.0",
311
+      "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz",
312
+      "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w="
313
+    },
314
+    "semver-regex": {
315
+      "version": "2.0.0",
316
+      "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-2.0.0.tgz",
317
+      "integrity": "sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw=="
318
+    },
319
+    "slash": {
320
+      "version": "3.0.0",
321
+      "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
322
+      "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q=="
323
+    },
324
+    "supports-color": {
325
+      "version": "7.1.0",
326
+      "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
327
+      "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
328
+      "requires": {
329
+        "has-flag": "^4.0.0"
330
+      }
331
+    },
332
+    "which-pm-runs": {
333
+      "version": "1.0.0",
334
+      "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz",
335
+      "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs="
336
+    },
337
+    "yaml": {
338
+      "version": "1.10.0",
339
+      "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.0.tgz",
340
+      "integrity": "sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg=="
341
+    }
342
+  }
343
+}
0 344
new file mode 100644
... ...
@@ -0,0 +1,26 @@
1
+{
2
+  "name": "synapse",
3
+  "version": "0.4.7",
4
+  "description": "A semantic launcher written in Vala",
5
+  "scripts": {
6
+    "format": "find src -name '*.vala' -exec uncrustify -c uncrustify.cfg --replace {} \\;"
7
+  },
8
+  "repository": {
9
+    "type": "git",
10
+    "url": "https://git.launchpad.net/synapse-project"
11
+  },
12
+  "author": "",
13
+  "license": "LGPL-2.1",
14
+  "dependencies": {
15
+    "@commitlint/cli": "^8.3.5",
16
+    "@commitlint/config-conventional": "^8.3.4",
17
+    "husky": "^4.2.5",
18
+    "nunjucks": "^3.2.1",
19
+    "standard-version": "^8.0.0"
20
+  },
21
+  "husky": {
22
+    "hooks": {
23
+      "pre-commit": "npm run format"
24
+    }
25
+  }
26
+}
... ...
@@ -15,397 +15,312 @@
15 15
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16
  *
17 17
  * Authored by Michal Hruby <michal.mhr@gmail.com>
18
- *
19 18
  */
20 19
 
21
-namespace Synapse
22
-{
23
-  public abstract class Action : Match
24
-  {
25
-    public int default_relevancy { get; set; }
26
-    public bool notify_match { get; set; default = true; }
20
+namespace Synapse {
21
+    public abstract class Action : Match {
22
+        public int default_relevancy { get; set; }
23
+        public bool notify_match { get; set; default = true; }
27 24
 
28
-    public abstract bool valid_for_match (Match match);
25
+        public abstract bool valid_for_match (Match match);
29 26
 
30
-    public virtual int get_relevancy_for_match (Match match)
31
-    {
32
-      return default_relevancy;
33
-    }
27
+        public virtual int get_relevancy_for_match (Match match) {
28
+            return default_relevancy;
29
+        }
30
+
31
+        public abstract void do_execute (Match source, Match? target = null);
34 32
 
35
-    public abstract void do_execute (Match source, Match? target = null);
33
+        public override void execute_with_target (Match source, Match? target = null) {
34
+            do_execute (source, target);
35
+            if (notify_match) source.executed ();
36
+        }
36 37
 
37
-    public override void execute_with_target (Match source, Match? target = null)
38
-    {
39
-      do_execute (source, target);
40
-      if (notify_match) source.executed ();
41 38
     }
42
-  }
43 39
 
44
-  public class CommonActions : Object, Activatable, ActionProvider
45
-  {
46
-    public bool enabled { get; set; default = true; }
40
+    public class CommonActions : Object, Activatable, ActionProvider {
41
+        public bool enabled { get; set; default = true; }
47 42
 
48
-    public void activate ()
49
-    {
50
-    }
43
+        public void activate () {}
51 44
 
52
-    public void deactivate ()
53
-    {
54
-    }
45
+        public void deactivate () {}
55 46
 
56
-    private class Runner : Action
57
-    {
58
-      public Runner ()
59
-      {
60
-        Object (title: _("Run"),
61
-                description: _("Run an application, action or script"),
62
-                icon_name: "system-run", has_thumbnail: false,
63
-                default_relevancy: MatchScore.EXCELLENT);
64
-      }
65
-
66
-      public override void do_execute (Match match, Match? target = null)
67
-      {
68
-        if (match is ApplicationMatch)
69
-        {
70
-          unowned ApplicationMatch app_match = (ApplicationMatch) match;
71
-
72
-          AppInfo app = app_match.app_info ??
73
-            new DesktopAppInfo.from_filename (app_match.filename);
74
-
75
-          try
76
-          {
77
-            app.launch (null, Gdk.Display.get_default ().get_app_launch_context ());
78
-
79
-            RelevancyService.get_default ().application_launched (app);
80
-          }
81
-          catch (Error err)
82
-          {
83
-            warning ("%s", err.message);
84
-          }
85
-        }
86
-        else if (match is ActionMatch)
87
-        {
88
-          ((ActionMatch) match).do_action ();
89
-        }
90
-        else if (match is Action)
91
-        {
92
-          ((Action) match).do_execute (match, target);
93
-        }
94
-        else if (match is UriMatch)
95
-        {
96
-          try
97
-          {
98
-            unowned string uri = ((UriMatch) match).uri;
99
-            if (uri.has_prefix ("file:"))
100
-            {
101
-              File file = File.new_for_uri (uri);
102
-              AppInfo app = AppInfo.create_from_commandline (
103
-                file.get_path (), file.get_basename (),
104
-                AppInfoCreateFlags.NONE);
105
-              app.launch (null, Gdk.Display.get_default ().get_app_launch_context ());
47
+        private class Runner : Action {
48
+            public Runner () {
49
+                Object (title: _("Run"),
50
+                        description: _("Run an application, action or script"),
51
+                        icon_name: "system-run", has_thumbnail: false,
52
+                        default_relevancy: MatchScore.EXCELLENT);
106 53
             }
107
-          }
108
-          catch (Error err)
109
-          {
110
-            warning ("%s", err.message);
111
-          }
112
-        }
113
-        else
114
-        {
115
-          warning ("'%s' is not be handled here", match.title);
116
-        }
117
-      }
118
-
119
-      public override bool valid_for_match (Match match)
120
-      {
121
-        if (match is UriMatch)
122
-        {
123
-          unowned string uri = ((UriMatch) match).uri;
124
-          if (uri.has_prefix ("file:"))
125
-          {
126
-            string path = File.new_for_uri (uri).get_path ();
127
-            return (FileUtils.test (path, FileTest.IS_EXECUTABLE) && !FileUtils.test (path, FileTest.IS_DIR));
128
-          }
129
-        }
130 54
 
131
-        return (match is Action ||
132
-                match is ActionMatch ||
133
-               (match is ApplicationMatch && !(((ApplicationMatch) match).needs_terminal)));
134
-      }
135
-    }
55
+            public override void do_execute (Match match, Match? target = null) {
56
+                if (match is ApplicationMatch) {
57
+                    unowned ApplicationMatch app_match = (ApplicationMatch) match;
58
+
59
+                    AppInfo app = app_match.app_info ??
60
+                                  new DesktopAppInfo.from_filename (app_match.filename);
61
+
62
+                    try {
63
+                        app.launch (null, Gdk.Display.get_default ().get_app_launch_context ());
64
+
65
+                        RelevancyService.get_default ().application_launched (app);
66
+                    } catch (Error err) {
67
+                        warning ("%s", err.message);
68
+                    }
69
+                } else if (match is ActionMatch) {
70
+                    ((ActionMatch) match).do_action ();
71
+                } else if (match is Action) {
72
+                    ((Action) match).do_execute (match, target);
73
+                } else if (match is UriMatch) {
74
+                    try {
75
+                        unowned string uri = ((UriMatch) match).uri;
76
+                        if (uri.has_prefix ("file:")) {
77
+                            File file = File.new_for_uri (uri);
78
+                            AppInfo app = AppInfo.create_from_commandline (
79
+                                file.get_path (), file.get_basename (),
80
+                                AppInfoCreateFlags.NONE);
81
+                            app.launch (null, Gdk.Display.get_default ().get_app_launch_context ());
82
+                        }
83
+                    } catch (Error err) {
84
+                        warning ("%s", err.message);
85
+                    }
86
+                } else {
87
+                    warning ("'%s' is not be handled here", match.title);
88
+                }
89
+            }
136 90
 
137
-    private class TerminalRunner : Action
138
-    {
139
-      public TerminalRunner ()
140
-      {
141
-        Object (title: _("Run in Terminal"),
142
-                description: _("Run application or command in terminal"),
143
-                icon_name: "terminal", has_thumbnail: false,
144
-                default_relevancy: MatchScore.BELOW_AVERAGE);
145
-      }
146
-
147
-      public override void do_execute (Match match, Match? target = null)
148
-      {
149
-        if (match is ApplicationMatch)
150
-        {
151
-          unowned ApplicationMatch app_match = (ApplicationMatch) match;
152
-
153
-          AppInfo original = app_match.app_info ??
154
-            new DesktopAppInfo.from_filename (app_match.filename);
155
-
156
-          try
157
-          {
158
-            AppInfo app = AppInfo.create_from_commandline (
159
-              original.get_commandline (), original.get_name (),
160
-              AppInfoCreateFlags.NEEDS_TERMINAL);
161
-            app.launch (null, Gdk.Display.get_default ().get_app_launch_context ());
162
-          }
163
-          catch (Error err)
164
-          {
165
-            warning ("%s", err.message);
166
-          }
167
-        }
168
-        else if (match is UriMatch)
169
-        {
170
-          try
171
-          {
172
-            unowned string uri = ((UriMatch) match).uri;
173
-            if (uri.has_prefix ("file:"))
174
-            {
175
-              File file = File.new_for_uri (uri);
176
-              AppInfo app = AppInfo.create_from_commandline (
177
-                file.get_path (), file.get_basename (),
178
-                AppInfoCreateFlags.NEEDS_TERMINAL);
179
-              app.launch (null, Gdk.Display.get_default ().get_app_launch_context ());
91
+            public override bool valid_for_match (Match match) {
92
+                if (match is UriMatch) {
93
+                    unowned string uri = ((UriMatch) match).uri;
94
+                    if (uri.has_prefix ("file:")) {
95
+                        string path = File.new_for_uri (uri).get_path ();
96
+                        return (FileUtils.test (path, FileTest.IS_EXECUTABLE) && !FileUtils.test (path, FileTest.IS_DIR));
97
+                    }
98
+                }
99
+
100
+                return (match is Action ||
101
+                        match is ActionMatch ||
102
+                        (match is ApplicationMatch && !(((ApplicationMatch) match).needs_terminal)));
180 103
             }
181
-          }
182
-          catch (Error err)
183
-          {
184
-            warning ("%s", err.message);
185
-          }
186
-        }
187
-      }
188
-
189
-      public override bool valid_for_match (Match match)
190
-      {
191
-        if (match is UriMatch)
192
-        {
193
-          unowned string uri = ((UriMatch) match).uri;
194
-          if (uri.has_prefix ("file:"))
195
-          {
196
-            string path = File.new_for_uri (uri).get_path ();
197
-            return (FileUtils.test (path, FileTest.IS_EXECUTABLE) && !FileUtils.test (path, FileTest.IS_DIR));
198
-          }
199
-        }
200
-        return (match is ApplicationMatch);
201
-      }
202
-    }
203 104
 
204
-    private class Opener : Action
205
-    {
206
-      public Opener ()
207
-      {
208
-        Object (title: _("Open"),
209
-                description: _("Open using default application"),
210
-                icon_name: "fileopen", has_thumbnail: false,
211
-                default_relevancy: MatchScore.GOOD);
212
-      }
213
-
214
-      public override void do_execute (Match match, Match? target = null)
215
-      {
216
-        unowned UriMatch? uri_match = match as UriMatch;
217
-
218
-        if (uri_match != null)
219
-        {
220
-          Utils.open_uri (uri_match.uri);
221
-        }
222
-        else if (file_path.match (match.title))
223
-        {
224
-          File f;
225
-          if (match.title.has_prefix ("~"))
226
-          {
227
-            f = File.new_for_path (Path.build_filename (Environment.get_home_dir (),
228
-                                                        match.title.substring (1),
229
-                                                        null));
230
-          }
231
-          else
232
-          {
233
-            f = File.new_for_path (match.title);
234
-          }
235
-          Utils.open_uri (f.get_uri ());
236
-        }
237
-        else
238
-        {
239
-          Utils.open_uri (match.title);
240
-        }
241
-      }
242
-
243
-      public override bool valid_for_match (Match match)
244
-      {
245
-        return (match is UriMatch || 
246
-               (match is UnknownMatch && (web_uri.match (match.title) || file_path.match (match.title))));
247
-      }
248
-
249
-      private Regex web_uri;
250
-      private Regex file_path;
251
-
252
-      construct
253
-      {
254
-        try
255
-        {
256
-          web_uri = new Regex ("^(ftp|http(s)?)://[^.]+\\.[^.]+", RegexCompileFlags.OPTIMIZE);
257
-          file_path = new Regex ("^(/|~/)[^/]+", RegexCompileFlags.OPTIMIZE);
258
-        }
259
-        catch (Error err)
260
-        {
261
-          warning ("%s", err.message);
262 105
         }
263
-      }
264
-    }
265 106
 
266
-    private class OpenFolder : Action
267
-    {
268
-      public OpenFolder ()
269
-      {
270
-        Object (title: _("Open folder"),
271
-                description: _("Open folder containing this file"),
272
-                icon_name: "folder-open", has_thumbnail: false,
273
-                default_relevancy: MatchScore.AVERAGE);
274
-      }
275
-
276
-      public override void do_execute (Match match, Match? target = null)
277
-      {
278
-        unowned UriMatch? uri_match = match as UriMatch;
279
-        return_if_fail (uri_match != null);
280
-
281
-        var f = File.new_for_uri (uri_match.uri);
282
-        f = f.get_parent ();
283
-        try
284
-        {
285
-          var app_info = f.query_default_handler (null);
286
-          List<File> files = new List<File> ();
287
-          files.prepend (f);
288
-          app_info.launch (files, Gdk.Display.get_default ().get_app_launch_context ());
289
-        }
290
-        catch (Error err)
291
-        {
292
-          warning ("%s", err.message);
293
-        }
294
-      }
107
+        private class TerminalRunner : Action {
108
+            public TerminalRunner () {
109
+                Object (title: _("Run in Terminal"),
110
+                        description: _("Run application or command in terminal"),
111
+                        icon_name: "terminal", has_thumbnail: false,
112
+                        default_relevancy: MatchScore.BELOW_AVERAGE);
113
+            }
295 114
 
296
-      public override bool valid_for_match (Match match)
297
-      {
298
-        unowned UriMatch? uri_match = match as UriMatch;
299
-        if (uri_match == null) return false;
115
+            public override void do_execute (Match match, Match? target = null) {
116
+                if (match is ApplicationMatch) {
117
+                    unowned ApplicationMatch app_match = (ApplicationMatch) match;
118
+
119
+                    AppInfo original = app_match.app_info ??
120
+                                       new DesktopAppInfo.from_filename (app_match.filename);
121
+
122
+                    try {
123
+                        AppInfo app = AppInfo.create_from_commandline (
124
+                            original.get_commandline (), original.get_name (),
125
+                            AppInfoCreateFlags.NEEDS_TERMINAL);
126
+                        app.launch (null, Gdk.Display.get_default ().get_app_launch_context ());
127
+                    } catch (Error err) {
128
+                        warning ("%s", err.message);
129
+                    }
130
+                } else if (match is UriMatch) {
131
+                    try {
132
+                        unowned string uri = ((UriMatch) match).uri;
133
+                        if (uri.has_prefix ("file:")) {
134
+                            File file = File.new_for_uri (uri);
135
+                            AppInfo app = AppInfo.create_from_commandline (
136
+                                file.get_path (), file.get_basename (),
137
+                                AppInfoCreateFlags.NEEDS_TERMINAL);
138
+                            app.launch (null, Gdk.Display.get_default ().get_app_launch_context ());
139
+                        }
140
+                    } catch (Error err) {
141
+                        warning ("%s", err.message);
142
+                    }
143
+                }
144
+            }
300 145
 
301
-        var f = File.new_for_uri (uri_match.uri);
302
-        var parent = f.get_parent ();
303
-        return parent != null && f.is_native ();
304
-      }
305
-    }
146
+            public override bool valid_for_match (Match match) {
147
+                if (match is UriMatch) {
148
+                    unowned string uri = ((UriMatch) match).uri;
149
+                    if (uri.has_prefix ("file:")) {
150
+                        string path = File.new_for_uri (uri).get_path ();
151
+                        return (FileUtils.test (path, FileTest.IS_EXECUTABLE) && !FileUtils.test (path, FileTest.IS_DIR));
152
+                    }
153
+                }
154
+                return (match is ApplicationMatch);
155
+            }
306 156
 
307
-    private class ClipboardCopy : Action
308
-    {
309
-      public ClipboardCopy ()
310
-      {
311
-        Object (title: _("Copy to Clipboard"),
312
-                description: _("Copy selection to clipboard"),
313
-                icon_name: "gtk-copy", has_thumbnail: false,
314
-                default_relevancy: MatchScore.AVERAGE);
315
-      }
316
-
317
-      public override void do_execute (Match match, Match? target = null)
318
-      {
319
-        var cb = Gtk.Clipboard.get (Gdk.Atom.NONE);
320
-        if (match is UriMatch)
321
-        {
322
-          unowned UriMatch uri_match = (UriMatch) match;
323
-
324
-          /*
325
-           // just wow, Gtk and also Vala are trying really hard to make this hard to do...
326
-          Gtk.TargetEntry[] no_entries = {};
327
-          Gtk.TargetList l = new Gtk.TargetList (no_entries);
328
-          l.add_uri_targets (0);
329
-          l.add_text_targets (0);
330
-          Gtk.TargetEntry te = Gtk.target_table_new_from_list (l, 2);
331
-          cb.set_with_data ();
332
-          */
333
-          cb.set_text (uri_match.uri, -1);
334 157
         }
335
-        else if (match is TextMatch)
336
-        {
337
-          unowned TextMatch text_match = (TextMatch) match;
338 158
 
339
-          string content = text_match != null ? text_match.get_text () : match.title;
159
+        private class Opener : Action {
160
+            public Opener () {
161
+                Object (title: _("Open"),
162
+                        description: _("Open using default application"),
163
+                        icon_name: "fileopen", has_thumbnail: false,
164
+                        default_relevancy: MatchScore.GOOD);
165
+            }
340 166
 
341
-          cb.set_text (content, -1);
342
-        }
343
-      }
344
-
345
-      public override bool valid_for_match (Match match)
346
-      {
347
-        return (match is UriMatch || match is TextMatch);
348
-      }
349
-
350
-      public override int get_relevancy_for_match (Match match)
351
-      {
352
-        unowned TextMatch? text_match = match as TextMatch;
353
-        if (text_match != null && text_match.text_origin == TextOrigin.CLIPBOARD)
354
-        {
355
-          return 0;
167
+            public override void do_execute (Match match, Match? target = null) {
168
+                unowned UriMatch? uri_match = match as UriMatch;
169
+
170
+                if (uri_match != null) {
171
+                    Utils.open_uri (uri_match.uri);
172
+                } else if (file_path.match (match.title)) {
173
+                    File f;
174
+                    if (match.title.has_prefix ("~")) {
175
+                        f = File.new_for_path (Path.build_filename (Environment.get_home_dir (),
176
+                                                                    match.title.substring (1),
177
+                                                                    null));
178
+                    } else {
179
+                        f = File.new_for_path (match.title);
180
+                    }
181
+                    Utils.open_uri (f.get_uri ());
182
+                } else {
183
+                    Utils.open_uri (match.title);
184
+                }
185
+            }
186
+
187
+            public override bool valid_for_match (Match match) {
188
+                return (match is UriMatch ||
189
+                        (match is UnknownMatch && (web_uri.match (match.title) || file_path.match (match.title))));
190
+            }
191
+
192
+            private Regex web_uri;
193
+            private Regex file_path;
194
+
195
+            construct {
196
+                try {
197
+                    web_uri = new Regex ("^(ftp|http(s)?)://[^.]+\\.[^.]+", RegexCompileFlags.OPTIMIZE);
198
+                    file_path = new Regex ("^(/|~/)[^/]+", RegexCompileFlags.OPTIMIZE);
199
+                } catch (Error err) {
200
+                    warning ("%s", err.message);
201
+                }
202
+            }
356 203
         }
357 204
 
358
-        return default_relevancy;
359
-      }
360
-    }
205
+        private class OpenFolder : Action {
206
+            public OpenFolder () {
207
+                Object (title: _("Open folder"),
208
+                        description: _("Open folder containing this file"),
209
+                        icon_name: "folder-open", has_thumbnail: false,
210
+                        default_relevancy: MatchScore.AVERAGE);
211
+            }
361 212
 
362
-    private Gee.List<Action> actions;
213
+            public override void do_execute (Match match, Match? target = null) {
214
+                unowned UriMatch? uri_match = match as UriMatch;
215
+                return_if_fail (uri_match != null);
216
+
217
+                var f = File.new_for_uri (uri_match.uri);
218
+                f = f.get_parent ();
219
+                try {
220
+                    var app_info = f.query_default_handler (null);
221
+                    List<File> files = new List<File> ();
222
+                    files.prepend (f);
223
+                    app_info.launch (files, Gdk.Display.get_default ().get_app_launch_context ());
224
+                } catch (Error err) {
225
+                    warning ("%s", err.message);
226
+                }
227
+            }
363 228
 
364
-    construct
365
-    {
366
-      actions = new Gee.ArrayList<Action> ();
229
+            public override bool valid_for_match (Match match) {
230
+                unowned UriMatch? uri_match = match as UriMatch;
231
+                if (uri_match == null) return false;
367 232
 
368
-      actions.add (new Runner ());
369
-      actions.add (new TerminalRunner ());
370
-      actions.add (new Opener ());
371
-      actions.add (new OpenFolder ());
372
-      actions.add (new ClipboardCopy ());
373
-    }
233
+                var f = File.new_for_uri (uri_match.uri);
234
+                var parent = f.get_parent ();
235
+                return parent != null && f.is_native ();
236
+            }
374 237
 
375
-    public ResultSet? find_for_match (ref Query query, Match match)
376
-    {
377
-      bool query_empty = query.query_string == "";
378
-      var results = new ResultSet ();
379
-
380
-      if (query_empty)
381
-      {
382
-        foreach (var action in actions)
383
-        {
384
-          if (action.valid_for_match (match))
385
-          {
386
-            results.add (action, action.get_relevancy_for_match (match));
387
-          }
388 238
         }
389
-      }
390
-      else
391
-      {
392
-        var matchers = Query.get_matchers_for_query (query.query_string, 0,
393
-          RegexCompileFlags.OPTIMIZE | RegexCompileFlags.CASELESS);
394
-        foreach (var action in actions)
395
-        {
396
-          if (!action.valid_for_match (match)) continue;
397
-          foreach (var matcher in matchers)
398
-          {
399
-            if (matcher.key.match (action.title))
400
-            {
401
-              results.add (action, matcher.value);
402
-              break;
239
+
240
+        private class ClipboardCopy : Action {
241
+            public ClipboardCopy () {
242
+                Object (title: _("Copy to Clipboard"),
243
+                        description: _("Copy selection to clipboard"),
244
+                        icon_name: "gtk-copy", has_thumbnail: false,
245
+                        default_relevancy: MatchScore.AVERAGE);
403 246
             }
404
-          }
247
+
248
+            public override void do_execute (Match match, Match? target = null) {
249
+                var cb = Gtk.Clipboard.get (Gdk.Atom.NONE);
250
+                if (match is UriMatch) {
251
+                    unowned UriMatch uri_match = (UriMatch) match;
252
+
253
+                    /*
254
+                       // just wow, Gtk and also Vala are trying really hard to make this hard to do...
255
+                       Gtk.TargetEntry[] no_entries = {};
256
+                       Gtk.TargetList l = new Gtk.TargetList (no_entries);
257
+                       l.add_uri_targets (0);
258
+                       l.add_text_targets (0);
259
+                       Gtk.TargetEntry te = Gtk.target_table_new_from_list (l, 2);
260
+                       cb.set_with_data ();
261
+                     */
262
+                    cb.set_text (uri_match.uri, -1);
263
+                } else if (match is TextMatch) {
264
+                    unowned TextMatch text_match = (TextMatch) match;
265
+
266
+                    string content = text_match != null ? text_match.get_text () : match.title;
267
+
268
+                    cb.set_text (content, -1);
269
+                }
270
+            }
271
+
272
+            public override bool valid_for_match (Match match) {
273
+                return (match is UriMatch || match is TextMatch);
274
+            }
275
+
276
+            public override int get_relevancy_for_match (Match match) {
277
+                unowned TextMatch? text_match = match as TextMatch;
278
+                if (text_match != null && text_match.text_origin == TextOrigin.CLIPBOARD) {
279
+                    return 0;
280
+                }
281
+
282
+                return default_relevancy;
283
+            }
284
+
405 285
         }
406
-      }
407 286
 
408
-      return results;
287
+        private Gee.List<Action> actions;
288
+
289
+        construct {
290
+            actions = new Gee.ArrayList<Action> ();
291
+
292
+            actions.add (new Runner ());
293
+            actions.add (new TerminalRunner ());
294
+            actions.add (new Opener ());
295
+            actions.add (new OpenFolder ());
296
+            actions.add (new ClipboardCopy ());
297
+        }
298
+
299
+        public ResultSet? find_for_match (ref Query query, Match match) {
300
+            bool query_empty = query.query_string == "";
301
+            var results = new ResultSet ();
302
+
303
+            if (query_empty) {
304
+                foreach (var action in actions) {
305
+                    if (action.valid_for_match (match)) {
306
+                        results.add (action, action.get_relevancy_for_match (match));
307
+                    }
308
+                }
309
+            } else {
310
+                var matchers = Query.get_matchers_for_query (query.query_string, 0,
311
+                                                             RegexCompileFlags.OPTIMIZE | RegexCompileFlags.CASELESS);
312
+                foreach (var action in actions) {
313
+                    if (!action.valid_for_match (match)) continue;
314
+                    foreach (var matcher in matchers) {
315
+                        if (matcher.key.match (action.title)) {
316
+                            results.add (action, matcher.value);
317
+                            break;
318
+                        }
319
+                    }
320
+                }
321
+            }
322
+
323
+            return results;
324
+        }
409 325
     }
410
-  }
411 326
 }
... ...
@@ -15,178 +15,151 @@
15 15
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16
  *
17 17
  * Authored by Michal Hruby <michal.mhr@gmail.com>
18
- *
19 18
  */
20 19
 
21
-namespace Synapse
22
-{
23
-  public abstract class ConfigObject : GLib.Object
24
-  {
25
-  }
26
-
27
-  public class ConfigService : GLib.Object
28
-  {
29
-    // singleton that can be easily destroyed
30
-    private static unowned ConfigService? instance;
31
-    public static ConfigService get_default ()
32
-    {
33
-      return instance ?? new ConfigService ();
34
-    }
20
+namespace Synapse {
21
+    public abstract class ConfigObject : GLib.Object {}
35 22
 
36
-    private ConfigService ()
37
-    {
38
-    }
23
+    public class ConfigService : GLib.Object {
24
+        // singleton that can be easily destroyed
25
+        private static unowned ConfigService? instance;
26
+        public static ConfigService get_default () {
27
+            return instance ?? new ConfigService ();
28
+        }
39 29
 
40
-    ~ConfigService ()
41
-    {
42
-      // useless cause the timer takes a reference on self
43
-      if (save_timer_id != 0) save ();
44
-      instance = null;
45
-    }
30
+        private ConfigService () {}
46 31
 
47
-    private Json.Node root_node;
48
-    private string config_file_name;
49
-    private uint save_timer_id = 0;
50
-
51
-    construct
52
-    {
53
-      instance = this;
54
-
55
-      var parser = new Json.Parser ();
56
-      config_file_name =
57
-        GLib.Path.build_filename (Environment.get_user_config_dir (), "synapse",
58
-                             "config.json");
59
-      try
60
-      {
61
-        parser.load_from_file (config_file_name);
62
-        root_node = parser.get_root ().copy ();
63
-        if (root_node.get_node_type () != Json.NodeType.OBJECT)
64
-        {
65
-          root_node = new Json.Node (Json.NodeType.OBJECT);
66
-          root_node.take_object (new Json.Object ());
32
+        ~ConfigService () {
33
+            // useless cause the timer takes a reference on self
34
+            if (save_timer_id != 0) save ();
35
+            instance = null;
67 36
         }
68
-      }
69
-      catch (Error err)
70
-      {
71
-        root_node = new Json.Node (Json.NodeType.OBJECT);
72
-        root_node.take_object (new Json.Object ());
73
-      }
74
-    }
75 37
 
76
-    /**
77
-     * Creates an instance of an object derived from ConfigObject class, which
78
-     * will have its public properties set to values stored in config file, or
79
-     * to the default values if this object wasn't yet stored.
80
-     *
81
-     * @param group A group name.
82
-     * @param key A key name.
83
-     * @param config_type Type of the object (must be subclass of ConfigObject)
84
-     * @return An instance of config_type.
85
-     */
86
-    public ConfigObject get_config (string group, string key, Type config_type)
87
-    {
88
-      unowned Json.Object obj = root_node.get_object ();
89
-      unowned Json.Node group_node = obj.get_member (group);
90
-      if (group_node != null)
91
-      {
92
-        if (group_node.get_node_type () == Json.NodeType.OBJECT)
93
-        {
94
-          unowned Json.Object group_obj = group_node.get_object ();
95
-          unowned Json.Node key_node = group_obj.get_member (key);
96
-          if (key_node != null && key_node.get_node_type () == Json.NodeType.OBJECT)
97
-          {
98
-            var result = Json.gobject_deserialize (config_type, key_node);
99
-            return result as ConfigObject;
100
-          }
38
+        private Json.Node root_node;
39
+        private string config_file_name;
40
+        private uint save_timer_id = 0;
41
+
42
+        construct {
43
+            instance = this;
44
+
45
+            var parser = new Json.Parser ();
46
+            config_file_name =
47
+                GLib.Path.build_filename (Environment.get_user_config_dir (), "synapse",
48
+                                          "config.json");
49
+            try {
50
+                parser.load_from_file (config_file_name);
51
+                root_node = parser.get_root ().copy ();
52
+                if (root_node.get_node_type () != Json.NodeType.OBJECT) {
53
+                    root_node = new Json.Node (Json.NodeType.OBJECT);
54
+                    root_node.take_object (new Json.Object ());
55
+                }
56
+            } catch (Error err) {
57
+                root_node = new Json.Node (Json.NodeType.OBJECT);
58
+                root_node.take_object (new Json.Object ());
59
+            }
101 60
         }
102
-      }
103 61
 
104
-      return GLib.Object.new (config_type) as ConfigObject;
105
-    }
62
+        /**
63
+         * Creates an instance of an object derived from ConfigObject class, which
64
+         * will have its public properties set to values stored in config file, or
65
+         * to the default values if this object wasn't yet stored.
66
+         *
67
+         * @param group A group name.
68
+         * @param key A key name.
69
+         * @param config_type Type of the object (must be subclass of ConfigObject)
70
+         * @return An instance of config_type.
71
+         */
72
+        public ConfigObject get_config (string group, string key, Type config_type) {
73
+            unowned Json.Object obj = root_node.get_object ();
74
+            unowned Json.Node group_node = obj.get_member (group);
75
+            if (group_node != null) {
76
+                if (group_node.get_node_type () == Json.NodeType.OBJECT) {
77
+                    unowned Json.Object group_obj = group_node.get_object ();
78
+                    unowned Json.Node key_node = group_obj.get_member (key);
79
+                    if (key_node != null && key_node.get_node_type () == Json.NodeType.OBJECT) {
80
+                        var result = Json.gobject_deserialize (config_type, key_node);
81
+                        return result as ConfigObject;
82
+                    }
83
+                }
84
+            }
85
+
86
+            return GLib.Object.new (config_type) as ConfigObject;
87
+        }
106 88
 
107
-    /**
108
-     * Behaves in a similar way to get_config, but it also watches for changes
109
-     * in the returned config object and saves them back to the config file
110
-     * (without the need of calling set_config).
111
-     *
112
-     * @param group A group name.
113
-     * @param key A key name.
114
-     * @param config_type Type of the object (must be subclass of ConfigObject)
115
-     */
116
-    public ConfigObject bind_config (string group, string key, Type config_type)
117
-    {
118
-      ConfigObject config_object = get_config (group, key, config_type);
119
-      // make sure the lambda doesn't take a ref on the config_object
120
-      unowned ConfigObject co = config_object;
121
-      co.notify.connect (() => {
122
-        this.set_config (group, key, co);
123
-      });
124
-      return config_object;
125
-    }
89
+        /**
90
+         * Behaves in a similar way to get_config, but it also watches for changes
91
+         * in the returned config object and saves them back to the config file
92
+         * (without the need of calling set_config).
93
+         *
94
+         * @param group A group name.
95
+         * @param key A key name.
96
+         * @param config_type Type of the object (must be subclass of ConfigObject)
97
+         */
98
+        public ConfigObject bind_config (string group, string key, Type config_type) {
99
+            ConfigObject config_object = get_config (group, key, config_type);
100
+            // make sure the lambda doesn't take a ref on the config_object
101
+            unowned ConfigObject co = config_object;
102
+            co.notify.connect (() => {
103
+                this.set_config (group, key, co);
104
+            });
105
+            return config_object;
106
+        }
126 107
 
127
-    /**
128
-     * Stores all public properties of the object to the config file under
129
-     * specified group and key names.
130
-     *
131
-     * @param group A group name.
132
-     * @param key A key name.
133
-     * @param cfg_obj ConfigObject instance.
134
-     */
135
-    public void set_config (string group, string key, ConfigObject cfg_obj)
136
-    {
137
-      unowned Json.Object obj = root_node.get_object ();
138
-      if (!obj.has_member (group) ||
139
-          obj.get_member (group).get_node_type () != Json.NodeType.OBJECT)
140
-      {
141
-        // why set_object_member works, but set_member doesn't ?!
142
-        obj.set_object_member (group, new Json.Object ());
143
-      }
144
-
145
-      unowned Json.Object group_obj = obj.get_object_member (group);
146
-      // why the hell is this necessary?
147
-      if (group_obj.has_member (key)) group_obj.remove_member (key);
148
-
149
-      Json.Node node = Json.gobject_serialize (cfg_obj);
150
-      group_obj.set_object_member (key, node.get_object ());
151
-
152
-      if (save_timer_id != 0) Source.remove (save_timer_id);
153
-      // on crap, this takes a reference on self
154
-      save_timer_id = Timeout.add (30000, this.save_timeout);
155
-    }
108
+        /**
109
+         * Stores all public properties of the object to the config file under
110
+         * specified group and key names.
111
+         *
112
+         * @param group A group name.
113
+         * @param key A key name.
114
+         * @param cfg_obj ConfigObject instance.
115
+         */
116
+        public void set_config (string group, string key, ConfigObject cfg_obj) {
117
+            unowned Json.Object obj = root_node.get_object ();
118
+            if (!obj.has_member (group) ||
119
+                obj.get_member (group).get_node_type () != Json.NodeType.OBJECT) {
120
+                // why set_object_member works, but set_member doesn't ?!
121
+                obj.set_object_member (group, new Json.Object ());
122
+            }
123
+
124
+            unowned Json.Object group_obj = obj.get_object_member (group);
125
+            // why the hell is this necessary?
126
+            if (group_obj.has_member (key)) group_obj.remove_member (key);
127
+
128
+            Json.Node node = Json.gobject_serialize (cfg_obj);
129
+            group_obj.set_object_member (key, node.get_object ());
130
+
131
+            if (save_timer_id != 0) Source.remove (save_timer_id);
132
+            // on crap, this takes a reference on self
133
+            save_timer_id = Timeout.add (30000, this.save_timeout);
134
+        }
156 135
 
157
-    private bool save_timeout ()
158
-    {
159
-      save_timer_id = 0;
160
-      save ();
136
+        private bool save_timeout () {
137
+            save_timer_id = 0;
138
+            save ();
161 139
 
162
-      return false;
163
-    }
140
+            return false;
141
+        }
142
+
143
+        /**
144
+         * Forces immediate saving of the configuration file to the filesystem.
145
+         */
146
+        public void save () {
147
+            if (save_timer_id != 0) {
148
+                Source.remove (save_timer_id);
149
+                save_timer_id = 0;
150
+            }
151
+
152
+            var generator = new Json.Generator ();
153
+            generator.pretty = true;
154
+            generator.set_root (root_node);
155
+
156
+            DirUtils.create_with_parents (GLib.Path.get_dirname (config_file_name), 0755);
157
+            try {
158
+                generator.to_file (config_file_name);
159
+            } catch (Error err) {
160
+                warning ("%s", err.message);
161
+            }
162
+        }
164 163
 
165
-    /**
166
-     * Forces immediate saving of the configuration file to the filesystem.
167
-     */
168
-    public void save ()
169
-    {
170
-      if (save_timer_id != 0)
171
-      {
172
-        Source.remove (save_timer_id);
173
-        save_timer_id = 0;
174
-      }
175
-
176
-      var generator = new Json.Generator ();
177
-      generator.pretty = true;
178
-      generator.set_root (root_node);
179
-
180
-      DirUtils.create_with_parents (GLib.Path.get_dirname (config_file_name), 0755);
181
-      try
182
-      {
183
-        generator.to_file (config_file_name);
184
-      }
185
-      catch (Error err)
186
-      {
187
-        warning ("%s", err.message);
188
-      }
189 164
     }
190
-  }
191 165
 }
192
-
... ...
@@ -15,471 +15,399 @@
15 15
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16
  *
17 17
  * Authored by Michal Hruby <michal.mhr@gmail.com>
18
- *
19 18
  */
20 19
 
21
-namespace Synapse
22
-{
23
-  public errordomain SearchError
24
-  {
25
-    SEARCH_CANCELLED,
26
-    UNKNOWN_ERROR
27
-  }
28
-
29
-  public interface SearchProvider : Object
30
-  {
31
-    public abstract async Gee.List<Match> search (string query,
32
-                                                  QueryFlags flags,
33
-                                                  ResultSet? dest_result_set,
34
-                                                  Cancellable? cancellable = null) throws SearchError;
35
-  }
36
-
37
-  public class DataSink : Object, SearchProvider
38
-  {
39
-    private class DataSinkConfiguration : ConfigObject
40
-    {
41
-      // vala keeps array lengths, and therefore doesn't support setting arrays
42
-      // via automatic public properties
43
-      private string[] _disabled_plugins = null;
44
-      public string[] disabled_plugins
45
-      {
46
-        get
47
-        {
48
-          return _disabled_plugins;
49
-        }
50
-        set
51
-        {
52
-          _disabled_plugins = value;
53
-        }
54
-      }
55
-
56
-      public void set_plugin_enabled (Type t, bool enabled)
57
-      {
58
-        if (enabled) enable_plugin (t.name ());
59
-        else disable_plugin (t.name ());
60
-      }
61
-
62
-      public bool is_plugin_enabled (Type t)
63
-      {
64
-        if (_disabled_plugins == null) return true;
65
-        unowned string plugin_name = t.name ();
66
-        foreach (string s in _disabled_plugins)
67
-        {
68
-          if (s == plugin_name) return false;
69
-        }
70
-        return true;
71
-      }
72
-
73
-      private void enable_plugin (string name)
74
-      {
75
-        if (_disabled_plugins == null) return;
76
-        if (!(name in _disabled_plugins)) return;
77
-
78
-        string[] cpy = {};
79
-        foreach (string s in _disabled_plugins)
80
-        {
81
-          if (s != name) cpy += s;
82
-        }
83
-        _disabled_plugins = (owned) cpy;
84
-      }
85
-
86
-      private void disable_plugin (string name)
87
-      {
88
-        if (_disabled_plugins == null || !(name in _disabled_plugins))
89
-        {
90
-          _disabled_plugins += name;
91
-        }
92
-      }
20
+namespace Synapse {
21
+    public errordomain SearchError {
22
+        SEARCH_CANCELLED,
23
+        UNKNOWN_ERROR
93 24
     }
94 25
 
95
-    public DataSink ()
96
-    {
97
-    }
26
+    public interface SearchProvider : Object {
27
+        public abstract async Gee.List<Match> search (string query,
28
+                                                      QueryFlags flags,
29
+                                                      ResultSet? dest_result_set,
30
+                                                      Cancellable? cancellable = null) throws SearchError;
98 31
 
99
-    ~DataSink ()
100
-    {
101
-      debug ("DataSink died...");
102 32
     }
103 33
 
104
-    private DataSinkConfiguration config;
105
-    private Gee.Set<ItemProvider> item_plugins;
106
-    private Gee.Set<ActionProvider> action_plugins;
107
-    private uint query_id;
108
-    // data sink will keep reference to the name cache, so others will get this
109
-    // instance on call to get_default()
110
-    private DBusService dbus_name_cache;
111
-    private DesktopFileService desktop_file_service;
112
-    private PluginRegistry registry;
113
-    private RelevancyService relevancy_service;
114
-    private VolumeService volume_service;
115
-    private Type[] plugin_types;
116
-
117
-    construct
118
-    {
119
-      item_plugins = new Gee.HashSet<ItemProvider> ();
120
-      action_plugins = new Gee.HashSet<ActionProvider> ();
121
-      plugin_types = {};
122
-      query_id = 0;
123
-
124
-      var cfg = ConfigService.get_default ();
125
-      config = (DataSinkConfiguration)
126
-        cfg.get_config ("data-sink", "global", typeof (DataSinkConfiguration));
127
-
128
-      // oh well, yea we need a few singletons
129
-      registry = PluginRegistry.get_default ();
130
-      relevancy_service = RelevancyService.get_default ();
131
-      volume_service = VolumeService.get_default ();
132
-
133
-      initialize_caches.begin ();
134
-      register_static_plugin (typeof (CommonActions));
135
-    }
34
+    public class DataSink : Object, SearchProvider {
35
+        private class DataSinkConfiguration : ConfigObject {
36
+            // vala keeps array lengths, and therefore doesn't support setting arrays
37
+            // via automatic public properties
38
+            private string[] _disabled_plugins = null;
39
+            public string[] disabled_plugins {
40
+                get {
41
+                    return _disabled_plugins;
42
+                }
43
+                set {
44
+                    _disabled_plugins = value;
45
+                }
46
+            }
136 47
 
137