[glibmm] DBusProxy: Wrap properites and signals.



commit 0d1893cd132a71de0b228f0fedd3f5a9df6606d0
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Tue Oct 26 01:05:37 2010 -0400

    	DBusProxy: Wrap properites and signals.
    
    	* tools/extra_defs_gen/generate_defs_gio.cc: Add a new section for
    	DBus types and add the GDBusProxy type to the gio extra defs
    	generation tool.
    	* gio/src/gio_signals.defs: Regenerate with the extra defs tool to get
    	the properties and signals of GDBusProxy.  Some types (like GVariant
    	and GStrv) have to be manually edited.
    	* gio/src/dbusproxy.hg: Wrap properties and (one of two) signals.
    	* tools/m4/convert_glib.m4: Add a const-gchar* to `const
    	Glib::ustring&' conversion (it may be more appropriate to include it
    	in dbusproxy.hg for the "g-signal" signal).

 ChangeLog                                 |   15 ++
 gio/src/dbusproxy.hg                      |   17 ++-
 gio/src/gio_signals.defs                  |  260 ++++++++++++++++++++---------
 tools/extra_defs_gen/generate_defs_gio.cc |    7 +-
 tools/m4/convert_glib.m4                  |    1 +
 5 files changed, 220 insertions(+), 80 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f17ae36..7ce9930 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-10-26  José Alburquerque  <jaalburqu svn gnome org>
+
+	DBusProxy: Wrap properites and signals.
+
+	* tools/extra_defs_gen/generate_defs_gio.cc: Add a new section for
+	DBus types and add the GDBusProxy type to the gio extra defs
+	generation tool.
+	* gio/src/gio_signals.defs: Regenerate with the extra defs tool to get
+	the properties and signals of GDBusProxy.  Some types (like GVariant
+	and GStrv) have to be manually edited.
+	* gio/src/dbusproxy.hg: Wrap properties and (one of two) signals.
+	* tools/m4/convert_glib.m4: Add a const-gchar* to `const
+	Glib::ustring&' conversion (it may be more appropriate to include it
+	in dbusproxy.hg for the "g-signal" signal).
+
 2010-10-25  José Alburquerque  <jaalburqu svn gnome org>
 
 	AsyncInitable: Add create_finish() wrapping an unwrapped function.
diff --git a/gio/src/dbusproxy.hg b/gio/src/dbusproxy.hg
index 8e9fec6..d654bed 100644
--- a/gio/src/dbusproxy.hg
+++ b/gio/src/dbusproxy.hg
@@ -161,7 +161,22 @@ g_dbus_proxy_call_finish)
   _WRAP_METHOD(GVariant* call_sync(const gchar* method_name, GVariant* parameters, GDBusCallFlags flags, gint timeout_msec, GCancellable* cancellable, GError** error), g_dbus_proxy_call_sync)
  */
 
- //TODO: Properties and signals.
+ _WRAP_PROPERTY("g-bus-type", BusType)
+ _WRAP_PROPERTY("g-connection", Glib::RefPtr<DBusConnection>)
+ _WRAP_PROPERTY("g-default-timeout", int)
+ _WRAP_PROPERTY("g-flags", DBusProxyFlags)
+ _WRAP_PROPERTY("g-interface-info", Glib::RefPtr<DBusInterfaceInfo>)
+ _WRAP_PROPERTY("g-interface-name", Glib::ustring)
+ _WRAP_PROPERTY("g-name", Glib::ustring)
+ _WRAP_PROPERTY("g-name-owner", Glib::ustring)
+ _WRAP_PROPERTY("g-object-path", Glib::ustring)
+
+#m4 _CONVERSION(`GVariant*', `const Glib::VariantBase&', `Glib::wrap($3, true)')
+
+//TODO: It's difficult to figure out conversions from/to GStrv (gchar**) to/from std::vector<Glib::ustring>
+ //_WRAP_SIGNAL(void properties_changed(const Glib::VariantBase& changed_properties, const std::vector<Glib::ustring>& invalidated_properties), g-properties-changed)
+
+ _WRAP_SIGNAL(void signal(const Glib::ustring& sender_name, const Glib::ustring& signal_name, const Glib::VariantBase& parameters), "g-signal")
 };
 
 } // namespace Gio
diff --git a/gio/src/gio_signals.defs b/gio/src/gio_signals.defs
index 55653a6..092a8bc 100644
--- a/gio/src/gio_signals.defs
+++ b/gio/src/gio_signals.defs
@@ -949,83 +949,6 @@
   )
 )
 
-;; From GDBusAuthObserver
-
-(define-signal authorize-authenticated-peer
-  (of-object "GDBusAuthObserver")
-  (return-type "gboolean")
-  (when "last")
-  (parameters
-    '("GIOStream*" "p0")
-    '("GCredentials*" "p1")
-  )
-)
-
-;; From GDBusServer
-
-(define-signal new-connection
-  (of-object "GDBusServer")
-  (return-type "gboolean")
-  (when "last")
-  (parameters
-    '("GDBusConnection*" "p0")
-  )
-)
-
-(define-property address
-  (of-object "GDBusServer")
-  (prop-type "GParamString")
-  (docs "The address to listen on")
-  (readable #t)
-  (writable #t)
-  (construct-only #t)
-)
-
-(define-property client-address
-  (of-object "GDBusServer")
-  (prop-type "GParamString")
-  (docs "The address clients can use")
-  (readable #t)
-  (writable #f)
-  (construct-only #f)
-)
-
-(define-property flags
-  (of-object "GDBusServer")
-  (prop-type "GParamFlags")
-  (docs "Flags for the server")
-  (readable #t)
-  (writable #t)
-  (construct-only #t)
-)
-
-(define-property guid
-  (of-object "GDBusServer")
-  (prop-type "GParamString")
-  (docs "The guid of the server")
-  (readable #t)
-  (writable #t)
-  (construct-only #t)
-)
-
-(define-property active
-  (of-object "GDBusServer")
-  (prop-type "GParamBoolean")
-  (docs "Whether the server is currently active")
-  (readable #t)
-  (writable #f)
-  (construct-only #f)
-)
-
-(define-property authentication-observer
-  (of-object "GDBusServer")
-  (prop-type "GParamObject")
-  (docs "Object used to assist in the authentication process")
-  (readable #t)
-  (writable #t)
-  (construct-only #t)
-)
-
 ;; From GInetAddress
 
 (define-property family
@@ -1664,3 +1587,186 @@
   (writable #t)
   (construct-only #t)
 )
+
+;; From GDBusAuthObserver
+
+(define-signal authorize-authenticated-peer
+  (of-object "GDBusAuthObserver")
+  (return-type "gboolean")
+  (when "last")
+  (parameters
+    '("GIOStream*" "p0")
+    '("GCredentials*" "p1")
+  )
+)
+
+;; From GDBusProxy
+
+(define-signal g-properties-changed
+  (of-object "GDBusProxy")
+  (return-type "void")
+  (when "last")
+  (parameters
+    '("GVariant*" "p0")
+    '("GStrv" "p1")
+  )
+)
+
+(define-signal g-signal
+  (of-object "GDBusProxy")
+  (return-type "void")
+  (when "last")
+  (parameters
+    '("const-gchar*" "p0")
+    '("const-gchar*" "p1")
+    '("GVariant*" "p2")
+  )
+)
+
+(define-property g-connection
+  (of-object "GDBusProxy")
+  (prop-type "GParamObject")
+  (docs "The connection the proxy is for")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property g-bus-type
+  (of-object "GDBusProxy")
+  (prop-type "GParamEnum")
+  (docs "The bus to connect to, if any")
+  (readable #f)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property g-name
+  (of-object "GDBusProxy")
+  (prop-type "GParamString")
+  (docs "The well-known or unique name that the proxy is for")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property g-name-owner
+  (of-object "GDBusProxy")
+  (prop-type "GParamString")
+  (docs "The unique name for the owner")
+  (readable #t)
+  (writable #f)
+  (construct-only #f)
+)
+
+(define-property g-flags
+  (of-object "GDBusProxy")
+  (prop-type "GParamFlags")
+  (docs "Flags for the proxy")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property g-object-path
+  (of-object "GDBusProxy")
+  (prop-type "GParamString")
+  (docs "The object path the proxy is for")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property g-interface-name
+  (of-object "GDBusProxy")
+  (prop-type "GParamString")
+  (docs "The D-Bus interface name the proxy is for")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property g-default-timeout
+  (of-object "GDBusProxy")
+  (prop-type "GParamInt")
+  (docs "Timeout for remote method invocation")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property g-interface-info
+  (of-object "GDBusProxy")
+  (prop-type "GParamBoxed")
+  (docs "Interface Information")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+;; From GDBusServer
+
+(define-signal new-connection
+  (of-object "GDBusServer")
+  (return-type "gboolean")
+  (when "last")
+  (parameters
+    '("GDBusConnection*" "p0")
+  )
+)
+
+(define-property address
+  (of-object "GDBusServer")
+  (prop-type "GParamString")
+  (docs "The address to listen on")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property client-address
+  (of-object "GDBusServer")
+  (prop-type "GParamString")
+  (docs "The address clients can use")
+  (readable #t)
+  (writable #f)
+  (construct-only #f)
+)
+
+(define-property flags
+  (of-object "GDBusServer")
+  (prop-type "GParamFlags")
+  (docs "Flags for the server")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property guid
+  (of-object "GDBusServer")
+  (prop-type "GParamString")
+  (docs "The guid of the server")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property active
+  (of-object "GDBusServer")
+  (prop-type "GParamBoolean")
+  (docs "Whether the server is currently active")
+  (readable #t)
+  (writable #f)
+  (construct-only #f)
+)
+
+(define-property authentication-observer
+  (of-object "GDBusServer")
+  (prop-type "GParamObject")
+  (docs "Object used to assist in the authentication process")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+
diff --git a/tools/extra_defs_gen/generate_defs_gio.cc b/tools/extra_defs_gen/generate_defs_gio.cc
index 6926aff..816cabb 100644
--- a/tools/extra_defs_gen/generate_defs_gio.cc
+++ b/tools/extra_defs_gen/generate_defs_gio.cc
@@ -87,8 +87,6 @@ int main(int, char**)
             << get_defs(G_TYPE_VOLUME_MONITOR)
 
             // network IO classes
-            << get_defs(G_TYPE_DBUS_AUTH_OBSERVER)
-            << get_defs(G_TYPE_DBUS_SERVER)
             << get_defs(G_TYPE_INET_ADDRESS)
             << get_defs(G_TYPE_INET_SOCKET_ADDRESS)
             << get_defs(G_TYPE_SOCKET_ADDRESS)
@@ -110,6 +108,11 @@ int main(int, char**)
             << get_defs(G_TYPE_SOCKET_SERVICE)
             << get_defs(G_TYPE_THREADED_SOCKET_SERVICE)
 
+            // DBus classes.
+            << get_defs(G_TYPE_DBUS_AUTH_OBSERVER)
+            << get_defs(G_TYPE_DBUS_PROXY)
+            << get_defs(G_TYPE_DBUS_SERVER)
+
             << std::endl;
   
   return 0;
diff --git a/tools/m4/convert_glib.m4 b/tools/m4/convert_glib.m4
index c7291bf..92df0d5 100644
--- a/tools/m4/convert_glib.m4
+++ b/tools/m4/convert_glib.m4
@@ -45,6 +45,7 @@ _CONVERSION(`const-gchar*',`Glib::ustring',__GCHARP_TO_USTRING)
 _CONVERSION(`const-guchar*',`Glib::ustring',__GCHARP_TO_USTRING)
 _CONVERSION(`const gchar*',`Glib::ustring',__GCHARP_TO_USTRING)
 _CONVERSION(`const char*',`Glib::ustring',__GCHARP_TO_USTRING)
+_CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING)
 _CONVERSION(`const char*',`std::string',__GCHARP_TO_STDSTRING)
 _CONVERSION(`const char*',`const-gchar*',`$3')
 _CONVERSION(`const-gchar*',`const char*',`$3')



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