[d-feet/wjt/pretty-print-byte-strings: 1/2] introspection: don't bother constructing a proxy



commit d642a08d4f9e98b88bfe54ebb32af3a143c46011
Author: Will Thompson <will willthompson co uk>
Date:   Tue Oct 23 11:21:15 2018 +0100

    introspection: don't bother constructing a proxy
    
    There's little point constructing the proxy object when it will be used
    once and thrown away. Sending the method call via the connection object
    also allows the expected return type (a single variant) to be specified.

 src/dfeet/introspection.py | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/dfeet/introspection.py b/src/dfeet/introspection.py
index fd41b92..3554866 100644
--- a/src/dfeet/introspection.py
+++ b/src/dfeet/introspection.py
@@ -104,14 +104,16 @@ class AddressInfo():
             dialog.run()
         elif isinstance(obj, DBusProperty):
             # update the selected property (TODO: do this async)
-            proxy = Gio.DBusProxy.new_sync(self.connection,
-                                           Gio.DBusProxyFlags.NONE,
-                                           None,
-                                           self.name,
-                                           obj.object_path,
-                                           "org.freedesktop.DBus.Properties", None)
             args = GLib.Variant('(ss)', (obj.iface_info.name, obj.property_info.name))
-            result = proxy.call_sync("Get", args, 0, -1, None)
+            result = self.connection.call_sync(self.name,
+                                               obj.object_path,
+                                               "org.freedesktop.DBus.Properties",
+                                               "Get",
+                                               args,
+                                               GLib.VariantType('(v)'),
+                                               Gio.DBusCallFlags.NONE,
+                                               -1,
+                                               None)
             # update the object value so markup string is calculated correct
             obj.value = result[0]
             # set new markup string


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]