[vala] D-Bus: Add flags parameter to get_proxy_sync methods



commit e3d62648f3c960850392c447d125228695bee2a1
Author: Jürg Billeter <j bitron ch>
Date:   Wed Oct 20 22:48:16 2010 +0200

    D-Bus: Add flags parameter to get_proxy_sync methods
    
    This also changes the default flags to DBusProxyFlags.NONE, which
    enables property caching.
    
    Fixes bug 631228.

 codegen/valagdbusclientmodule.vala        |    5 +++--
 tests/dbus/arrays.test                    |    2 +-
 tests/dbus/basic-types.test               |    2 +-
 tests/dbus/structs.test                   |    2 +-
 vapi/gio-2.0.vapi                         |    4 ++--
 vapi/packages/gio-2.0/gio-2.0-custom.vala |    4 ++--
 6 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/codegen/valagdbusclientmodule.vala b/codegen/valagdbusclientmodule.vala
index 5302195..4333034 100644
--- a/codegen/valagdbusclientmodule.vala
+++ b/codegen/valagdbusclientmodule.vala
@@ -222,7 +222,8 @@ public class Vala.GDBusClientModule : GDBusModule {
 		var args = expr.get_argument_list ();
 		Expression name = args.get (base_arg_index + 0);
 		Expression object_path = args.get (base_arg_index + 1);
-		Expression cancellable = args.get (base_arg_index + 2);
+		Expression flags = args.get (base_arg_index + 2);
+		Expression cancellable = args.get (base_arg_index + 3);
 
 		// method can fail
 		current_method_inner_error = true;
@@ -233,7 +234,7 @@ public class Vala.GDBusClientModule : GDBusModule {
 		ccall.add_argument (get_cvalue (cancellable));
 		ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_variable_cexpression ("_inner_error_")));
 		ccall.add_argument (new CCodeConstant ("\"g-flags\""));
-		ccall.add_argument (new CCodeConstant ("G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES"));
+		ccall.add_argument (get_cvalue (flags));
 		ccall.add_argument (new CCodeConstant ("\"g-name\""));
 		name.emit (this);
 		ccall.add_argument (get_cvalue (name));
diff --git a/tests/dbus/arrays.test b/tests/dbus/arrays.test
index fd52c32..fa884ca 100644
--- a/tests/dbus/arrays.test
+++ b/tests/dbus/arrays.test
@@ -13,7 +13,7 @@ interface Test : Object {
 
 void main () {
 	// client
-	Test test = Bus.get_proxy_sync (BusType.SESSION, "org.example.Test", "/org/example/test");
+	Test test = Bus.get_proxy_sync (BusType.SESSION, "org.example.Test", "/org/example/test", DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
 
 	int[] j, k;
 	k = test.test_int ({ 42 }, out j);
diff --git a/tests/dbus/basic-types.test b/tests/dbus/basic-types.test
index e6366be..9b183f7 100644
--- a/tests/dbus/basic-types.test
+++ b/tests/dbus/basic-types.test
@@ -14,7 +14,7 @@ interface Test : Object {
 
 void main () {
 	// client
-	Test test = Bus.get_proxy_sync (BusType.SESSION, "org.example.Test", "/org/example/test");
+	Test test = Bus.get_proxy_sync (BusType.SESSION, "org.example.Test", "/org/example/test", DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
 
 	test.test_void ();
 
diff --git a/tests/dbus/structs.test b/tests/dbus/structs.test
index 73311ca..d23dd84 100644
--- a/tests/dbus/structs.test
+++ b/tests/dbus/structs.test
@@ -22,7 +22,7 @@ interface Test : Object {
 
 void main () {
 	// client
-	Test test = Bus.get_proxy_sync (BusType.SESSION, "org.example.Test", "/org/example/test");
+	Test test = Bus.get_proxy_sync (BusType.SESSION, "org.example.Test", "/org/example/test", DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
 
 	FooStruct f, g, h;
 	f = FooStruct (42, "hello");
diff --git a/vapi/gio-2.0.vapi b/vapi/gio-2.0.vapi
index 9ca6806..8283164 100644
--- a/vapi/gio-2.0.vapi
+++ b/vapi/gio-2.0.vapi
@@ -7,7 +7,7 @@ namespace GLib {
 		[CCode (cheader_filename = "gio/gio.h")]
 		public static async GLib.DBusConnection @get (GLib.BusType bus_type, GLib.Cancellable? cancellable = null) throws GLib.IOError;
 		[CCode (cheader_filename = "gio/gio.h")]
-		public static T get_proxy_sync<T> (GLib.BusType bus_type, string name, string object_path, GLib.Cancellable? cancellable = null) throws GLib.IOError;
+		public static T get_proxy_sync<T> (GLib.BusType bus_type, string name, string object_path, GLib.DBusProxyFlags flags = 0, GLib.Cancellable? cancellable = null) throws GLib.IOError;
 		[CCode (cheader_filename = "gio/gio.h")]
 		public static GLib.DBusConnection get_sync (GLib.BusType bus_type, GLib.Cancellable? cancellable = null) throws GLib.IOError;
 		[CCode (cname = "g_bus_own_name_with_closures", cheader_filename = "gio/gio.h")]
@@ -200,7 +200,7 @@ namespace GLib {
 		public bool get_exit_on_close ();
 		public unowned string get_guid ();
 		public unowned GLib.Credentials get_peer_credentials ();
-		public T get_proxy_sync<T> (string? name, string object_path, GLib.Cancellable? cancellable = null) throws GLib.IOError;
+		public T get_proxy_sync<T> (string? name, string object_path, GLib.DBusProxyFlags flags = 0, GLib.Cancellable? cancellable = null) throws GLib.IOError;
 		public unowned GLib.IOStream get_stream ();
 		public unowned string get_unique_name ();
 		public bool is_closed ();
diff --git a/vapi/packages/gio-2.0/gio-2.0-custom.vala b/vapi/packages/gio-2.0/gio-2.0-custom.vala
index 0517e4c..ed214fe 100644
--- a/vapi/packages/gio-2.0/gio-2.0-custom.vala
+++ b/vapi/packages/gio-2.0/gio-2.0-custom.vala
@@ -56,7 +56,7 @@ namespace GLib {
 	namespace Bus {
 		public async GLib.DBusConnection get (GLib.BusType bus_type, GLib.Cancellable? cancellable = null) throws GLib.IOError;
 		public GLib.DBusConnection get_sync (GLib.BusType bus_type, GLib.Cancellable? cancellable = null) throws GLib.IOError;
-		public T get_proxy_sync<T> (GLib.BusType bus_type, string name, string object_path, GLib.Cancellable? cancellable = null) throws GLib.IOError;
+		public T get_proxy_sync<T> (GLib.BusType bus_type, string name, string object_path, GLib.DBusProxyFlags flags = 0, GLib.Cancellable? cancellable = null) throws GLib.IOError;
 		[CCode (cname = "g_bus_own_name_with_closures")]
 		public uint own_name (GLib.BusType bus_type, string name, GLib.BusNameOwnerFlags flags, [CCode (type = "GClosure*")] owned GLib.BusAcquiredCallback bus_acquired_handler, [CCode (type = "GClosure*")] owned GLib.BusNameAcquiredCallback name_acquired_handler, [CCode (type = "GClosure*")] owned GLib.BusNameLostCallback name_lost_handler);
 		[CCode (cname = "g_bus_own_name_on_connection_with_closures")]
@@ -71,7 +71,7 @@ namespace GLib {
 
 	[CCode (cname = "GDBusConnection")]
 	public class DBusConnection {
-		public T get_proxy_sync<T> (string? name, string object_path, GLib.Cancellable? cancellable = null) throws GLib.IOError;
+		public T get_proxy_sync<T> (string? name, string object_path, GLib.DBusProxyFlags flags = 0, GLib.Cancellable? cancellable = null) throws GLib.IOError;
 		public uint register_object<T> (string object_path, T object) throws GLib.IOError;
 	}
 }



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