]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
D-Bus: Support BusName sender parameter in GDBus servers
authorJürg Billeter <j@bitron.ch>
Mon, 20 Dec 2010 21:57:13 +0000 (22:57 +0100)
committerJürg Billeter <j@bitron.ch>
Mon, 20 Dec 2010 22:03:54 +0000 (23:03 +0100)
codegen/valagdbusclientmodule.vala
codegen/valagdbusservermodule.vala
vapi/glib-2.0.vapi

index c69f212070bf93de9b748c43ccc809377c3e985b..4b945f3f746c1a9a1f1635b1cb8880c5fa789ab9 100644 (file)
@@ -496,6 +496,11 @@ public class Vala.GDBusClientModule : GDBusModule {
                                                continue;
                                        }
 
+                                       if (param.variable_type is ObjectType && param.variable_type.data_type.get_full_name () == "GLib.BusName") {
+                                               // ignore BusName sender parameters
+                                               continue;
+                                       }
+
                                        send_dbus_value (param.variable_type, new CCodeIdentifier ("_arguments_builder"), expr, param);
                                }
                        }
index f1a52844ea8cd0cae34039b1f3e628131122539a..688b2d7e3b1c4c0a17d1c930a64bfa0a43a10bb3 100644 (file)
@@ -124,6 +124,11 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                        continue;
                                }
 
+                               if (param.variable_type is ObjectType && param.variable_type.data_type.get_full_name () == "GLib.BusName") {
+                                       // ignore BusName sender parameters
+                                       continue;
+                               }
+
                                var owned_type = param.variable_type.copy ();
                                owned_type.value_owned = true;
 
@@ -152,6 +157,14 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                        continue;
                                }
 
+                               if (param.variable_type is ObjectType && param.variable_type.data_type.get_full_name () == "GLib.BusName") {
+                                       // ignore BusName sender parameters
+                                       var sender = new CCodeFunctionCall (new CCodeIdentifier ("g_dbus_method_invocation_get_sender"));
+                                       sender.add_argument (new CCodeIdentifier ("invocation"));
+                                       ccall.add_argument (sender);
+                                       continue;
+                               }
+
                                var st = param.variable_type.data_type as Struct;
                                if (st != null && !st.is_simple_type ()) {
                                        ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param.name)));
@@ -351,6 +364,11 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                        continue;
                                }
 
+                               if (param.variable_type is ObjectType && param.variable_type.data_type.get_full_name () == "GLib.BusName") {
+                                       // ignore BusName sender parameters
+                                       continue;
+                               }
+
                                var owned_type = param.variable_type.copy ();
                                owned_type.value_owned = true;
 
@@ -816,6 +834,9 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                if (param.variable_type is ObjectType && param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
                                        continue;
                                }
+                               if (param.variable_type is ObjectType && param.variable_type.data_type.get_full_name () == "GLib.BusName") {
+                                       continue;
+                               }
 
                                var info = new CCodeInitializerList ();
                                info.append (new CCodeConstant ("-1"));
index 90665091c187328293c44d3bb4bbca8704fe2c0a..ec8a51ca4cb7e3f4c02ffe6f0be5fc4561cb4bdf 100644 (file)
@@ -4321,6 +4321,12 @@ namespace GLib {
                [CCode (cname = "g_strdup")]
                public ObjectPath (string path);
        }
+
+       [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", param_spec_function = "g_param_spec_string", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string", take_value_function = "g_value_take_string")]
+       public class BusName : string {
+               [CCode (cname = "g_strdup")]
+               public BusName (string bus_name);
+       }
 #endif
 
        [CCode (cname = "G_LIKELY", cheader_filename = "glib.h")]