Commit e3d62648 authored by Jürg Billeter's avatar Jürg Billeter

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.
parent 0de4fba7
...@@ -222,7 +222,8 @@ public class Vala.GDBusClientModule : GDBusModule { ...@@ -222,7 +222,8 @@ public class Vala.GDBusClientModule : GDBusModule {
var args = expr.get_argument_list (); var args = expr.get_argument_list ();
Expression name = args.get (base_arg_index + 0); Expression name = args.get (base_arg_index + 0);
Expression object_path = args.get (base_arg_index + 1); 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 // method can fail
current_method_inner_error = true; current_method_inner_error = true;
...@@ -233,7 +234,7 @@ public class Vala.GDBusClientModule : GDBusModule { ...@@ -233,7 +234,7 @@ public class Vala.GDBusClientModule : GDBusModule {
ccall.add_argument (get_cvalue (cancellable)); ccall.add_argument (get_cvalue (cancellable));
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_variable_cexpression ("_inner_error_"))); 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-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\"")); ccall.add_argument (new CCodeConstant ("\"g-name\""));
name.emit (this); name.emit (this);
ccall.add_argument (get_cvalue (name)); ccall.add_argument (get_cvalue (name));
......
...@@ -13,7 +13,7 @@ interface Test : Object { ...@@ -13,7 +13,7 @@ interface Test : Object {
void main () { void main () {
// client // 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; int[] j, k;
k = test.test_int ({ 42 }, out j); k = test.test_int ({ 42 }, out j);
......
...@@ -14,7 +14,7 @@ interface Test : Object { ...@@ -14,7 +14,7 @@ interface Test : Object {
void main () { void main () {
// client // 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 (); test.test_void ();
......
...@@ -22,7 +22,7 @@ interface Test : Object { ...@@ -22,7 +22,7 @@ interface Test : Object {
void main () { void main () {
// client // 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; FooStruct f, g, h;
f = FooStruct (42, "hello"); f = FooStruct (42, "hello");
......
...@@ -7,7 +7,7 @@ namespace GLib { ...@@ -7,7 +7,7 @@ namespace GLib {
[CCode (cheader_filename = "gio/gio.h")] [CCode (cheader_filename = "gio/gio.h")]
public static async GLib.DBusConnection @get (GLib.BusType bus_type, GLib.Cancellable? cancellable = null) throws GLib.IOError; public static async GLib.DBusConnection @get (GLib.BusType bus_type, GLib.Cancellable? cancellable = null) throws GLib.IOError;
[CCode (cheader_filename = "gio/gio.h")] [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")] [CCode (cheader_filename = "gio/gio.h")]
public static GLib.DBusConnection get_sync (GLib.BusType bus_type, GLib.Cancellable? cancellable = null) throws GLib.IOError; 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")] [CCode (cname = "g_bus_own_name_with_closures", cheader_filename = "gio/gio.h")]
...@@ -200,7 +200,7 @@ namespace GLib { ...@@ -200,7 +200,7 @@ namespace GLib {
public bool get_exit_on_close (); public bool get_exit_on_close ();
public unowned string get_guid (); public unowned string get_guid ();
public unowned GLib.Credentials get_peer_credentials (); 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 GLib.IOStream get_stream ();
public unowned string get_unique_name (); public unowned string get_unique_name ();
public bool is_closed (); public bool is_closed ();
......
...@@ -56,7 +56,7 @@ namespace GLib { ...@@ -56,7 +56,7 @@ namespace GLib {
namespace Bus { namespace Bus {
public async GLib.DBusConnection get (GLib.BusType bus_type, GLib.Cancellable? cancellable = null) throws GLib.IOError; 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 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")] [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); 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")] [CCode (cname = "g_bus_own_name_on_connection_with_closures")]
...@@ -71,7 +71,7 @@ namespace GLib { ...@@ -71,7 +71,7 @@ namespace GLib {
[CCode (cname = "GDBusConnection")] [CCode (cname = "GDBusConnection")]
public class DBusConnection { 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; public uint register_object<T> (string object_path, T object) throws GLib.IOError;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment