Merge lp:~xapantu/wingpanel-indicator-notifications/nodbusglib into lp:~wingpanel-devs/wingpanel-indicator-notifications/wingpanel-indicator-notifications
- nodbusglib
- Merge into wingpanel-indicator-notifi...
Status: | Merged |
---|---|
Approved by: | xapantu |
Approved revision: | 44 |
Merged at revision: | 44 |
Proposed branch: | lp:~xapantu/wingpanel-indicator-notifications/nodbusglib |
Merge into: | lp:~wingpanel-devs/wingpanel-indicator-notifications/wingpanel-indicator-notifications |
Diff against target: |
606 lines (+84/-394) 5 files modified
src/CMakeLists.txt (+1/-3) src/Indicator.vala (+7/-5) src/Services/Notification.vala (+27/-36) src/Services/NotificationsMonitor.vala (+49/-35) src/Services/dbus-glib-1.vapi (+0/-315) |
To merge this branch: | bzr merge lp:~xapantu/wingpanel-indicator-notifications/nodbusglib |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Adam Bieńkowski (community) | code / function | Needs Fixing | |
kay van der Zander | Needs Fixing | ||
Review via email: mp+271925@code.launchpad.net |
Commit message
* Use again native GLib to handle DBus messages.
* Fix bug #1468851.
Description of the change
Don't break everything with dbus-glib-1 :P
xapantu (xapantu) wrote : | # |
For the record, this is just a revert of a broken commit, so I am not
really responsible for the code here (ok, that's a bad excuse, and I
know it).
Also, we really need to talk about that, but that kind of thing should
not be a merge request blocker, really.
I will change that if I have some time, as I am always a peaceful guy.
Lucas
On 22/09/2015 11:02, kay van der Zander wrote:
> Review: Needs Fixing
>
> hey nice work.
>
> i have some comments see the diff comments.
> You know i don't lik the use of 'this' and i am not the only one ;).
> my advice is to remove it because there is already a difference in name of the parameters.
> started with _<name>
>
> Diff comments:
>
>>
>> === modified file 'src/Services/
>> --- src/Services/
>> +++ src/Services/
>> @@ -52,19 +52,27 @@
>> public DBusIface? dbusiface = null;
>> private uint32 id_counter = 0;
>>
>> - public signal void received (Notification notification);
>> + public signal void received (DBusMessage message, uint32 id);
>>
>> public NotificationMonitor () {
>> try {
>> connection = Bus.get_sync (BusType.SESSION);
>> + this.add_filter ();
>> } catch (Error e) {
>> error ("%s\n", e.message);
>> }
>>
>> - this.add_filter ();
>
> also remove blank line
>
>> }
>>
>> private void add_filter () {
>> + var message = new DBusMessage.
>> + "/org/freedeskt
>> + "org.freedeskto
>> + "AddMatch");
>> +
>> + var body = new Variant.parsed ("(%s,)", MATCH_STRING);
>> + message.set_body (body);
>> +
>> try {
>> niface = Bus.get_proxy_sync (BusType.SESSION, "org.freedeskto
>> "/org/freedeskt
>> @@ -73,43 +81,54 @@
>> }
>>
>> id_counter = get_current_
>> -
>> - var filter_connection = DBus.Bus.@get (DBus.BusType.
>> - var raw_connection = filter_
>> - var error = DBus.RawError ();
>> - raw_connection.
>> - raw_connection.
>> - }
>> -
>> - private DBus.RawHandler
>> - if (message.get_sender () != "org.freedeskto
>> - var notification = new Notification.
>> - uint replaces_id = notification.
>> - uint current_id = replaces_id;
>> -
>> - if (replaces_id == 0) {
>> - id_counter++;
>> - current_id = id_counter;
>> - }
>> -
>> - if (nsettings.
>> - this.received (notification);
>> - ...
kay van der Zander (kay20) wrote : | # |
when the diff comment are fixed i will aprove the merge
Adam Bieńkowski (donadigo) wrote : | # |
Thanks for your work there! I am giving Needs Fixing only for the codestyle isses, I commented on the diff what I would like to change but it's not essential. From the function point of view it's all OK.
xapantu (xapantu) wrote : | # |
Updated
- 44. By xapantu
-
Put back the old code with a few fixes, so as it does not break the api (see bug #1468851)
Preview Diff
1 | === modified file 'src/CMakeLists.txt' |
2 | --- src/CMakeLists.txt 2015-08-21 14:28:29 +0000 |
3 | +++ src/CMakeLists.txt 2015-09-23 21:50:46 +0000 |
4 | @@ -1,7 +1,7 @@ |
5 | find_package (PkgConfig) |
6 | |
7 | # Add all your dependencies to the list below |
8 | -pkg_check_modules (DEPS REQUIRED wingpanel-2.0 granite gio-2.0 gdk-pixbuf-2.0 libwnck-3.0 dbus-glib-1) |
9 | +pkg_check_modules (DEPS REQUIRED wingpanel-2.0 granite gio-2.0 gdk-pixbuf-2.0 libwnck-3.0) |
10 | |
11 | add_definitions (${DEPS_CFLAGS}) |
12 | add_definitions (-DWNCK_I_KNOW_THIS_IS_UNSTABLE) |
13 | @@ -31,8 +31,6 @@ |
14 | gio-2.0 |
15 | granite |
16 | libwnck-3.0 |
17 | -CUSTOM_VAPIS |
18 | - Services/dbus-glib-1.vapi |
19 | ) |
20 | |
21 | add_library (${CMAKE_PROJECT_NAME} MODULE ${VALA_C}) |
22 | |
23 | === modified file 'src/Indicator.vala' |
24 | --- src/Indicator.vala 2015-08-21 14:27:21 +0000 |
25 | +++ src/Indicator.vala 2015-09-23 21:50:46 +0000 |
26 | @@ -124,11 +124,13 @@ |
27 | } |
28 | }); |
29 | |
30 | - monitor.received.connect ((notification) => { |
31 | - if (!(notification.app_name in EXCEPTIONS || notification.app_name in settings.blacklist)) { |
32 | - var entry = new NotificationEntry (notification); |
33 | - nlist.add_item (entry); |
34 | - } |
35 | + monitor.received.connect ((message, id) => { |
36 | + var notification = new Notification.from_message (message, id); |
37 | + if (notification.app_name in EXCEPTIONS || notification.app_name in settings.blacklist) |
38 | + return; |
39 | + |
40 | + var entry = new NotificationEntry (notification); |
41 | + nlist.add_item (entry); |
42 | |
43 | dynamic_icon.set_main_icon_name (get_display_icon_name ()); |
44 | }); |
45 | |
46 | === modified file 'src/Services/Notification.vala' |
47 | --- src/Services/Notification.vala 2015-08-21 14:27:21 +0000 |
48 | +++ src/Services/Notification.vala 2015-09-23 21:50:46 +0000 |
49 | @@ -32,7 +32,7 @@ |
50 | * we need to store them in the separate |
51 | * variables. |
52 | */ |
53 | - public uint id; |
54 | + public uint32 id; |
55 | public uint64 id_64; |
56 | public uint32 pid = 0; |
57 | public DateTime timestamp; |
58 | @@ -55,49 +55,25 @@ |
59 | private const string DEFAULT = "default"; |
60 | private bool pid_accuired; |
61 | |
62 | - public Notification.from_message (DBus.RawMessage message, uint32 _id) { |
63 | - void* _app_name, _replaces_id, _app_icon, _summary, _body, _actions, _hints, _expire_timeout; |
64 | - |
65 | - DBus.RawMessageIter iter; |
66 | - message.iter_init (out iter); |
67 | + public Notification.from_message (DBusMessage message, uint32 _id) { |
68 | + var body = message.get_body (); |
69 | |
70 | this.data_session = false; |
71 | |
72 | - iter.get_basic (out _app_name); |
73 | - iter.next (); |
74 | - |
75 | - iter.get_basic (out _replaces_id); |
76 | - iter.next (); |
77 | - |
78 | - iter.get_basic (out _app_icon); |
79 | - iter.next (); |
80 | - |
81 | - iter.get_basic (out _summary); |
82 | - iter.next (); |
83 | - |
84 | - iter.get_basic (out _body); |
85 | - iter.next (); |
86 | - |
87 | - iter.get_basic (out _actions); |
88 | - iter.next (); |
89 | - iter.next (); |
90 | - |
91 | - iter.get_basic (out _expire_timeout); |
92 | - |
93 | - this.app_name = (string) _app_name; |
94 | + this.app_name = this.get_string (body, Column.APP_NAME); |
95 | this.display_name = app_name; |
96 | - this.replaces_id = (uint) _replaces_id; |
97 | - this.app_icon = (string) _app_icon; |
98 | - this.summary = (string) _summary; |
99 | - this.message_body = (string) _body; |
100 | - this.actions = (string[]) actions; |
101 | - this.expire_timeout = (int) expire_timeout; |
102 | + this.app_icon = this.get_string (body, Column.APP_ICON); |
103 | + this.summary = this.get_string (body, Column.SUMMARY); |
104 | + this.message_body = this.get_string (body, Column.BODY); |
105 | + this.expire_timeout = this.get_int32 (body, Column.EXPIRE_TIMEOUT); |
106 | + this.replaces_id = this.get_uint32 (body, Column.REPLACES_ID); |
107 | this.id = _id; |
108 | this.id_64 = -1; |
109 | this.sender = message.get_sender (); |
110 | |
111 | setup_pid (); |
112 | |
113 | + this.actions = body.get_child_value (Column.ACTIONS).dup_strv (); |
114 | this.timestamp = new DateTime.now_local (); |
115 | this.unix_time = timestamp.to_unix (); |
116 | |
117 | @@ -116,7 +92,8 @@ |
118 | this.message_body = _message_body; |
119 | this.expire_timeout = -1; |
120 | this.replaces_id = 0; |
121 | - this.id = (uint32) _id; |
122 | + this.id_64 = _id; |
123 | + this.id = -1; |
124 | this.sender = _sender; |
125 | |
126 | setup_pid (); |
127 | @@ -147,7 +124,6 @@ |
128 | if (dbusiface.name_has_owner (sender)) { |
129 | this.pid = dbusiface.get_connection_unix_process_id (sender); |
130 | } |
131 | - |
132 | } catch (Error e) { |
133 | error ("%s\n", e.message); |
134 | } |
135 | @@ -164,6 +140,21 @@ |
136 | return false; |
137 | } |
138 | |
139 | + private string get_string (Variant tuple, int column) { |
140 | + var child = tuple.get_child_value (column); |
141 | + return child.dup_string (); |
142 | + } |
143 | + |
144 | + private int32 get_int32 (Variant tuple, int column) { |
145 | + var child = tuple.get_child_value (column); |
146 | + return child.get_int32 (); |
147 | + } |
148 | + |
149 | + private uint32 get_uint32 (Variant tuple, int column) { |
150 | + var child = tuple.get_child_value (column); |
151 | + return child.get_uint32 (); |
152 | + } |
153 | + |
154 | private bool source_func () { |
155 | return this.time_changed (timestamp.difference (new DateTime.now_local ())); |
156 | } |
157 | |
158 | === modified file 'src/Services/NotificationsMonitor.vala' |
159 | --- src/Services/NotificationsMonitor.vala 2015-08-21 14:30:03 +0000 |
160 | +++ src/Services/NotificationsMonitor.vala 2015-09-23 21:50:46 +0000 |
161 | @@ -44,7 +44,7 @@ |
162 | } |
163 | |
164 | public class NotificationMonitor : Object { |
165 | - private const string MATCH_RULE = "eavesdrop=true,type='method_call',interface='org.freedesktop.Notifications',member='Notify'"; |
166 | + private const string MATCH_STRING = "eavesdrop='true',type='method_call',interface='org.freedesktop.Notifications',member='Notify'"; |
167 | private const uint32 REASON_DISMISSED = 2; |
168 | |
169 | private DBusConnection connection; |
170 | @@ -52,19 +52,26 @@ |
171 | public DBusIface? dbusiface = null; |
172 | private uint32 id_counter = 0; |
173 | |
174 | - public signal void received (Notification notification); |
175 | + public signal void received (DBusMessage message, uint32 id); |
176 | |
177 | public NotificationMonitor () { |
178 | try { |
179 | connection = Bus.get_sync (BusType.SESSION); |
180 | + this.add_filter (); |
181 | } catch (Error e) { |
182 | error ("%s\n", e.message); |
183 | } |
184 | - |
185 | - this.add_filter (); |
186 | } |
187 | |
188 | private void add_filter () { |
189 | + var message = new DBusMessage.method_call ("org.freedesktop.DBus", |
190 | + "/org/freedesktop/DBus", |
191 | + "org.freedesktop.DBus", |
192 | + "AddMatch"); |
193 | + |
194 | + var body = new Variant.parsed ("(%s,)", MATCH_STRING); |
195 | + message.set_body (body); |
196 | + |
197 | try { |
198 | niface = Bus.get_proxy_sync (BusType.SESSION, "org.freedesktop.Notifications", |
199 | "/org/freedesktop/Notifications"); |
200 | @@ -73,42 +80,49 @@ |
201 | } |
202 | |
203 | id_counter = get_current_notification_id (); |
204 | + try { |
205 | + connection.send_message (message, DBusSendMessageFlags.NONE, null); |
206 | + } catch (Error e) { |
207 | + error ("%s\n", e.message); |
208 | + } |
209 | |
210 | - var filter_connection = DBus.Bus.@get (DBus.BusType.SESSION); |
211 | - var raw_connection = filter_connection.get_connection (); |
212 | - var error = DBus.RawError (); |
213 | - raw_connection.add_match (MATCH_RULE, ref error); |
214 | - raw_connection.add_filter (message_filter); |
215 | + connection.add_filter (message_filter); |
216 | } |
217 | |
218 | - private DBus.RawHandlerResult message_filter (DBus.RawConnection connection, DBus.RawMessage message) { |
219 | - if (message.get_sender () != "org.freedesktop.DBus") { |
220 | - var notification = new Notification.from_message (message, id_counter); |
221 | - uint replaces_id = notification.replaces_id; |
222 | - uint current_id = replaces_id; |
223 | - |
224 | - if (replaces_id == 0) { |
225 | - id_counter++; |
226 | - current_id = id_counter; |
227 | - } |
228 | - |
229 | - if (nsettings.do_not_disturb) { |
230 | - this.received (notification); |
231 | - } else { |
232 | - niface.notification_closed.connect ((id, reason) => { |
233 | - if (id == 1) { |
234 | - id_counter = id; |
235 | - current_id = id_counter; |
236 | - } |
237 | - |
238 | - if (reason != REASON_DISMISSED && current_id == id) { |
239 | - this.received (notification); |
240 | - } |
241 | - }); |
242 | + private DBusMessage message_filter (DBusConnection con, owned DBusMessage message, bool incoming) { |
243 | + if (incoming) { |
244 | + if ((message.get_message_type () == DBusMessageType.METHOD_CALL) && |
245 | + (message.get_interface () == "org.freedesktop.Notifications") && |
246 | + (message.get_member () == "Notify")) { |
247 | + uint32 replaces_id = message.get_body ().get_child_value (1).get_uint32 (); |
248 | + uint32 current_id = replaces_id; |
249 | + |
250 | + if (replaces_id == 0) { |
251 | + id_counter++; |
252 | + current_id = id_counter; |
253 | + } |
254 | + |
255 | + if (nsettings.do_not_disturb) { |
256 | + this.received (message, current_id); |
257 | + } else { |
258 | + niface.notification_closed.connect ((id, reason) => { |
259 | + if (id == 1) { |
260 | + id_counter = id; |
261 | + current_id = id_counter; |
262 | + } |
263 | + |
264 | + if (reason != REASON_DISMISSED && current_id == id) { |
265 | + this.received (message, id); |
266 | + message = null; |
267 | + } |
268 | + }); |
269 | + } |
270 | + return null; |
271 | + |
272 | } |
273 | } |
274 | |
275 | - return DBus.RawHandlerResult.HANDLED; |
276 | + return message; |
277 | } |
278 | |
279 | /* Check what's the current notification id */ |
280 | @@ -122,4 +136,4 @@ |
281 | error ("%s\n", e.message); |
282 | } |
283 | } |
284 | -} |
285 | \ No newline at end of file |
286 | +} |
287 | |
288 | === removed file 'src/Services/dbus-glib-1.vapi' |
289 | --- src/Services/dbus-glib-1.vapi 2015-08-21 14:27:21 +0000 |
290 | +++ src/Services/dbus-glib-1.vapi 1970-01-01 00:00:00 +0000 |
291 | @@ -1,315 +0,0 @@ |
292 | -/* dbus-glib-1.vala |
293 | - * |
294 | - * Copyright (C) 2007-2010 Jürg Billeter |
295 | - * |
296 | - * This library is free software; you can redistribute it and/or |
297 | - * modify it under the terms of the GNU Lesser General Public |
298 | - * License as published by the Free Software Foundation; either |
299 | - * version 2.1 of the License, or (at your option) any later version. |
300 | - |
301 | - * This library is distributed in the hope that it will be useful, |
302 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
303 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
304 | - * Lesser General Public License for more details. |
305 | - |
306 | - * You should have received a copy of the GNU Lesser General Public |
307 | - * License along with this library; if not, write to the Free Software |
308 | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
309 | - * |
310 | - * Author: |
311 | - * Jürg Billeter <j@bitron.ch> |
312 | - * Michael 'Mickey' Lauer <mlauer@vanille-media.de> |
313 | - */ |
314 | - |
315 | -[CCode (cheader_filename = "dbus/dbus-glib-lowlevel.h,dbus/dbus-glib.h", gir_namespace = "DBusGLib", gir_version = "1.0")] |
316 | -namespace DBus { |
317 | - public const string SERVICE_DBUS; |
318 | - public const string PATH_DBUS; |
319 | - public const string INTERFACE_DBUS; |
320 | - |
321 | - public const string INTERFACE_INTROSPECTABLE; |
322 | - public const string INTERFACE_PROPERTIES; |
323 | - public const string INTERFACE_PEER; |
324 | - |
325 | - [CCode (cname = "dbus_g_thread_init")] |
326 | - public static void thread_init (); |
327 | - |
328 | - [CCode (cprefix = "DBUS_BUS_")] |
329 | - public enum BusType { |
330 | - SESSION, |
331 | - SYSTEM, |
332 | - STARTER |
333 | - } |
334 | - |
335 | - [CCode (lower_case_cprefix = "dbus_bus_")] |
336 | - namespace RawBus { |
337 | - public static RawConnection get (BusType type, ref RawError error); |
338 | - } |
339 | - |
340 | - [CCode (ref_function = "dbus_connection_ref", unref_function = "dbus_connection_unref", cname = "DBusConnection", cprefix = "dbus_connection_")] |
341 | - public class RawConnection { |
342 | - [CCode (cname = "dbus_connection_setup_with_g_main")] |
343 | - public void setup_with_main (GLib.MainContext? context = null); |
344 | - [CCode (cname = "dbus_connection_get_g_connection")] |
345 | - public unowned Connection get_g_connection (); |
346 | - [CCode (cname = "dbus_connection_register_g_object")] |
347 | - public void register_object (string at_path, GLib.Object object); |
348 | - |
349 | - public bool send (RawMessage message, uint32? client_serial); |
350 | - public RawMessage send_with_reply_and_block (RawMessage message, int timeout_milliseconds, ref RawError error); |
351 | - |
352 | - public bool add_filter (RawHandleMessageFunction function, RawFreeFunction? free_data_function = null); |
353 | - public void remove_filter (RawHandleMessageFunction function); |
354 | - |
355 | - [CCode (cname = "dbus_bus_add_match")] |
356 | - public void add_match (string rule, ref RawError error); |
357 | - [CCode (cname = "dbus_bus_remove_match")] |
358 | - public void remove_match (string rule, ref RawError error); |
359 | - [CCode (cname = "dbus_bus_get_unique_name")] |
360 | - public unowned string get_unique_name(); |
361 | - [CCode (cname = "dbus_bus_request_name")] |
362 | - public int request_name(string name, uint flags, ref RawError error); |
363 | - [CCode (cname="dbus_bus_release_name")] |
364 | - public int release_name(string name, ref RawError error); |
365 | - } |
366 | - |
367 | - [CCode (cname = "DBusError", cprefix = "dbus_error_", destroy_function = "dbus_error_free")] |
368 | - public struct RawError { |
369 | - public string name; |
370 | - public string message; |
371 | - |
372 | - public RawError (); |
373 | - public bool has_name (string name); |
374 | - public bool is_set (); |
375 | - } |
376 | - |
377 | - [CCode (cname = "DBusFreeFunction", has_target = false)] |
378 | - public delegate void* RawFreeFunction (void* memory); |
379 | - [CCode (cname = "DBusHandleMessageFunction", instance_pos = -1)] |
380 | - public delegate RawHandlerResult RawHandleMessageFunction(RawConnection connection, RawMessage message); |
381 | - |
382 | - [CCode (cname = "DBusHandlerResult", cprefix = "DBUS_HANDLER_RESULT_")] |
383 | - public enum RawHandlerResult { |
384 | - HANDLED, |
385 | - NOT_YET_HANDLED, |
386 | - NEED_MEMORY |
387 | - } |
388 | - |
389 | - [CCode (cname = "DBusMessageIter", cprefix = "dbus_message_iter_")] |
390 | - public struct RawMessageIter { |
391 | - public bool has_next (); |
392 | - public bool next (); |
393 | - public string get_signature (); |
394 | - public int get_arg_type (); |
395 | - public int get_element_type (); |
396 | - public void recurse (RawMessageIter sub); |
397 | - public void get_basic (out void* value); |
398 | - public bool open_container (RawType arg_type, string? signature, RawMessageIter sub); |
399 | - public bool close_container (RawMessageIter sub); |
400 | - public bool append_basic (RawType arg_type, void* value); |
401 | - |
402 | - [CCode (cname = "dbus_message_type_from_string")] |
403 | - public static int type_from_string (string type); |
404 | - [CCode (cname = "dbus_message_type_to_string")] |
405 | - public static string type_to_string (int type); |
406 | - } |
407 | - |
408 | - [CCode (ref_function = "dbus_message_ref", unref_function = "dbus_message_unref", cname = "DBusMessage", cprefix = "dbus_message_")] |
409 | - public class RawMessage { |
410 | - [CCode (cname = "dbus_message_new_method_call")] |
411 | - public RawMessage.call (string bus_name, string path, string interface, string method); |
412 | - [CCode (sentinel = "DBUS_TYPE_INVALID")] |
413 | - public bool append_args (RawType first_arg_type, ...); |
414 | - [CCode (cname = "dbus_message_iter_init")] |
415 | - public bool iter_init (out RawMessageIter iter); |
416 | - [CCode (cname = "dbus_message_iter_init_append")] |
417 | - public bool iter_init_append (RawMessageIter iter); |
418 | - |
419 | - public RawMessageType get_type (); |
420 | - public bool set_path (string object_path); |
421 | - public unowned string get_path (); |
422 | - public bool has_path (string object_path); |
423 | - public bool set_interface (string iface); |
424 | - public unowned string get_interface (); |
425 | - public bool has_interface (string iface); |
426 | - public bool set_member (string member); |
427 | - public unowned string get_member (); |
428 | - public bool has_member (string member); |
429 | - public bool set_error_name (string name); |
430 | - public unowned string get_error_name (); |
431 | - public bool set_destination (string destination); |
432 | - public unowned string get_destination (); |
433 | - public bool set_sender (string sender); |
434 | - public unowned string get_sender (); |
435 | - public unowned string get_signature (); |
436 | - public void set_no_reply (bool no_reply); |
437 | - public bool get_no_reply (); |
438 | - public bool is_method_call (string iface, string method); |
439 | - public bool is_signal (string iface, string signal_name); |
440 | - public bool is_error (string error_name); |
441 | - public bool has_destination (string bus_name); |
442 | - public bool has_sender (string unique_bus_name); |
443 | - public bool has_signature (string signature); |
444 | - public uint32 get_serial (); |
445 | - public void set_serial (uint32 serial); |
446 | - public bool set_reply_serial (uint32 reply_serial); |
447 | - public uint32 get_reply_serial (); |
448 | - public void set_auto_start (bool auto_start); |
449 | - public bool get_auto_start (); |
450 | - public bool get_path_decomposed (out char[] path ); |
451 | - } |
452 | - |
453 | - [CCode (cname = "int", cprefix = "DBUS_MESSAGE_TYPE_")] |
454 | - public enum RawMessageType { |
455 | - INVALID, |
456 | - METHOD_CALL, |
457 | - METHOD_RETURN, |
458 | - ERROR, |
459 | - SIGNAL |
460 | - } |
461 | - |
462 | - [CCode (cname = "int", cprefix = "DBUS_TYPE_")] |
463 | - public enum RawType { |
464 | - INVALID, |
465 | - BYTE, |
466 | - BOOLEAN, |
467 | - INT16, |
468 | - UINT16, |
469 | - INT32, |
470 | - UINT32, |
471 | - INT64, |
472 | - UINT64, |
473 | - DOUBLE, |
474 | - STRING, |
475 | - OBJECT_PATH, |
476 | - SIGNATURE, |
477 | - ARRAY, |
478 | - VARIANT, |
479 | - STRUCT, |
480 | - DICT_ENTRY, |
481 | - } |
482 | - |
483 | - [DBus (name = "org.freedesktop.DBus.Error")] |
484 | - [CCode (cname = "DBusGError", lower_case_csuffix = "gerror", cprefix = "DBUS_GERROR_")] |
485 | - public errordomain Error { |
486 | - FAILED, |
487 | - NO_MEMORY, |
488 | - SERVICE_UNKNOWN, |
489 | - NAME_HAS_NO_OWNER, |
490 | - NO_REPLY, |
491 | - [DBus (name = "IOError")] |
492 | - IO_ERROR, |
493 | - BAD_ADDRESS, |
494 | - NOT_SUPPORTED, |
495 | - LIMITS_EXCEEDED, |
496 | - ACCESS_DENIED, |
497 | - AUTH_FAILED, |
498 | - NO_SERVER, |
499 | - TIMEOUT, |
500 | - NO_NETWORK, |
501 | - ADDRESS_IN_USE, |
502 | - DISCONNECTED, |
503 | - INVALID_ARGS, |
504 | - FILE_NOT_FOUND, |
505 | - FILE_EXISTS, |
506 | - UNKNOWN_METHOD, |
507 | - TIMED_OUT, |
508 | - MATCH_RULE_NOT_FOUND, |
509 | - MATCH_RULE_INVALID, |
510 | - [DBus (name = "Spawn.ExecFailed")] |
511 | - SPAWN_EXEC_FAILED, |
512 | - [DBus (name = "Spawn.ForkFailed")] |
513 | - SPAWN_FORK_FAILED, |
514 | - [DBus (name = "Spawn.ChildExited")] |
515 | - SPAWN_CHILD_EXITED, |
516 | - [DBus (name = "Spawn.ChildSignaled")] |
517 | - SPAWN_CHILD_SIGNALED, |
518 | - [DBus (name = "Spawn.Failed")] |
519 | - SPAWN_FAILED, |
520 | - UNIX_PROCESS_ID_UNKNOWN, |
521 | - INVALID_SIGNATURE, |
522 | - INVALID_FILE_CONTENT, |
523 | - [DBus (name = "SELinuxSecurityContextUnknown")] |
524 | - SELINUX_SECURITY_CONTEXT_UNKNOWN, |
525 | - REMOTE_EXCEPTION |
526 | - } |
527 | - |
528 | - public struct Bus { |
529 | - [CCode (cname = "dbus_g_bus_get")] |
530 | - public static Connection get (BusType type) throws Error; |
531 | - } |
532 | - |
533 | - [Compact] |
534 | - [CCode (ref_function = "dbus_g_connection_ref", unref_function = "dbus_g_connection_unref", cname = "DBusGConnection")] |
535 | - public class Connection { |
536 | - [CCode (cname = "dbus_g_connection_open")] |
537 | - public Connection (string address) throws Error; |
538 | - [CCode (cname = "dbus_g_proxy_new_for_name")] |
539 | - public Object get_object (string name, string path, string? interface_ = null); |
540 | - [CCode (cname="dbus_g_proxy_new_for_name_owner")] |
541 | - public Object get_object_for_name_owner (string name, string path, string? interface_ = null) throws Error; |
542 | - [CCode (cname = "dbus_g_proxy_new_from_type")] |
543 | - public GLib.Object get_object_from_type (string name, string path, string interface_, GLib.Type type); |
544 | - [CCode (cname = "dbus_g_connection_register_g_object")] |
545 | - public void register_object (string at_path, GLib.Object object); |
546 | - [CCode (cname = "dbus_g_connection_unregister_g_object")] |
547 | - public void unregister_object (GLib.Object object); |
548 | - [CCode (cname = "dbus_g_connection_lookup_g_object")] |
549 | - public unowned GLib.Object lookup_object (string at_path); |
550 | - [CCode (cname = "dbus_g_connection_get_connection")] |
551 | - public unowned RawConnection get_connection (); |
552 | - } |
553 | - |
554 | - [CCode (cname = "DBusGProxy", lower_case_csuffix = "g_proxy")] |
555 | - public class Object : GLib.Object { |
556 | - public bool call (string method, out GLib.Error error, GLib.Type first_arg_type, ...); |
557 | - public unowned ProxyCall begin_call (string method, ProxyCallNotify notify, GLib.DestroyNotify destroy, GLib.Type first_arg_type, ...); |
558 | - public bool end_call (ProxyCall call, out GLib.Error error, GLib.Type first_arg_type, ...); |
559 | - public void cancel_call (ProxyCall call); |
560 | - public unowned string get_path (); |
561 | - public unowned string get_bus_name (); |
562 | - public unowned string get_interface (); |
563 | - public GLib.HashTable<string,GLib.Value?> get_all (string interface_name) throws DBus.Error; |
564 | - |
565 | - public signal void destroy (); |
566 | - } |
567 | - |
568 | - [CCode (cname = "char", const_cname = "const char", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "DBUS_TYPE_G_OBJECT_PATH", marshaller_type_name = "BOXED", get_value_function = "g_value_get_boxed", set_value_function = "g_value_set_boxed", type_signature = "o")] |
569 | - public class ObjectPath : string { |
570 | - [CCode (cname = "g_strdup")] |
571 | - public ObjectPath (string path); |
572 | - } |
573 | - |
574 | - [CCode (cname = "char", const_cname = "const char", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "G_TYPE_STRING", marshaller_type_name = "STRING", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string")] |
575 | - public class BusName : string { |
576 | - [CCode (cname = "g_strdup")] |
577 | - public BusName (string bus_name); |
578 | - } |
579 | - |
580 | - [CCode (cname = "DBusGProxyCallNotify")] |
581 | - public delegate void ProxyCallNotify (Object obj, ProxyCall call_id); |
582 | - |
583 | - [CCode (cname = "DBusGProxyCall")] |
584 | - public class ProxyCall { |
585 | - } |
586 | - |
587 | - [CCode (cname = "DBusGMethodInvocation")] |
588 | - public class MethodInvocation { |
589 | - } |
590 | - |
591 | - [Flags] |
592 | - [CCode (cname = "uint")] |
593 | - public enum NameFlag { |
594 | - ALLOW_REPLACEMENT, |
595 | - REPLACE_EXISTING, |
596 | - DO_NOT_QUEUE |
597 | - } |
598 | - |
599 | - [CCode (cname = "int")] |
600 | - public enum RequestNameReply { |
601 | - PRIMARY_OWNER, |
602 | - IN_QUEUE, |
603 | - EXISTS, |
604 | - ALREADY_OWNER |
605 | - } |
606 | -} |
hey nice work.
i have some comments see the diff comments.
You know i don't lik the use of 'this' and i am not the only one ;).
my advice is to remove it because there is already a difference in name of the parameters.
started with _<name>