[glibmm] DBus[MethodInvocation|Server]: Code corrections.



commit 49e391e3770be0b071691cea2fc8b4a66c14420c
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Tue Nov 30 02:49:10 2010 -0500

    	DBus[MethodInvocation|Server]: Code corrections.
    
    	* gio/src/dbusmethodinvocation.hg: Remove the default constructor
    	because it probably will not be used (there is no create() method to
    	go along with it).
    	* gio/src/dbusserver.{ccg,hg} (create_sync): Use
    	g_dbus_server_new_sync() instead of the constructors because the C
    	function does more than call g_initable_new().

 ChangeLog                       |   11 ++++++++++
 gio/src/dbusmethodinvocation.hg |    3 --
 gio/src/dbusserver.ccg          |   42 +++++++++++++++++++++++++++++++++++---
 gio/src/dbusserver.hg           |    1 +
 4 files changed, 50 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 20db9c2..7369a93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-11-30  José Alburquerque  <jaalburqu svn gnome org>
+
+	DBus[MethodInvocation|Server]: Code corrections.
+
+	* gio/src/dbusmethodinvocation.hg: Remove the default constructor
+	because it probably will not be used (there is no create() method to
+	go along with it).
+	* gio/src/dbusserver.{ccg,hg} (create_sync): Use
+	g_dbus_server_new_sync() instead of the constructors because the C
+	function does more than call g_initable_new().
+
 2010-11-22  José Alburquerque  <jaalburqu svn gnome org>
 
 	gmmproc: Some conversion fixes.
diff --git a/gio/src/dbusmethodinvocation.hg b/gio/src/dbusmethodinvocation.hg
index 2efaa3e..e5b126b 100644
--- a/gio/src/dbusmethodinvocation.hg
+++ b/gio/src/dbusmethodinvocation.hg
@@ -45,9 +45,6 @@ class DBusMethodInvocation : public Glib::Object
 {
   _CLASS_GOBJECT(DBusMethodInvocation, GDBusMethodInvocation, G_DBUS_METHOD_INVOCATION, Glib::Object, GObject)
 
-protected:
-   _CTOR_DEFAULT
-
 public:
   _WRAP_METHOD(Glib::ustring get_sender() const, g_dbus_method_invocation_get_sender)
   _WRAP_METHOD(Glib::ustring get_object_path() const, g_dbus_method_invocation_get_object_path)
diff --git a/gio/src/dbusserver.ccg b/gio/src/dbusserver.ccg
index 29076ff..2914f9d 100644
--- a/gio/src/dbusserver.ccg
+++ b/gio/src/dbusserver.ccg
@@ -57,8 +57,25 @@ Glib::RefPtr<DBusServer> DBusServer::create_sync(const Glib::ustring& address,
   const Glib::RefPtr<Cancellable>& cancellable,
   DBusServerFlags flags)
 {
-  return Glib::RefPtr<DBusServer>(new DBusServer(address, guid, observer,
-    cancellable, flags));
+  //TODO: Use the constructor instead of the code underneath when
+  //g_dbus_server_new_sync() does not do more than call g_initable_new().
+  //return Glib::RefPtr<DBusServer>(new DBusServer(address, guid, observer,
+    //cancellable, flags));
+
+  GError* gerror = 0;
+
+  Glib::RefPtr<DBusServer> result =
+    Glib::wrap(g_dbus_server_new_sync(address.c_str(),
+                                      static_cast<GDBusServerFlags>(flags),
+                                      guid.c_str(),
+                                      Glib::unwrap(observer),
+                                      Glib::unwrap(cancellable),
+                                      &gerror));
+
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+
+  return result;
 }
 
 Glib::RefPtr<DBusServer> DBusServer::create_sync(const Glib::ustring& address,
@@ -66,8 +83,25 @@ Glib::RefPtr<DBusServer> DBusServer::create_sync(const Glib::ustring& address,
   const Glib::RefPtr<DBusAuthObserver>& observer,
   DBusServerFlags flags)
 {
-  return Glib::RefPtr<DBusServer>(new DBusServer(address, guid, observer,
-    flags));
+  //TODO: Use the constructor instead of the code underneath when
+  //g_dbus_server_new_sync() does not do more than call g_initable_new().
+  //return Glib::RefPtr<DBusServer>(new DBusServer(address, guid, observer,
+    //flags));
+
+  GError* gerror = 0;
+
+  Glib::RefPtr<DBusServer> result =
+    Glib::wrap(g_dbus_server_new_sync(address.c_str(),
+                                      static_cast<GDBusServerFlags>(flags),
+                                      guid.c_str(),
+                                      Glib::unwrap(observer),
+                                      0,
+                                      &gerror));
+
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+
+  return result;
 }
 
 } // namespace Gio
diff --git a/gio/src/dbusserver.hg b/gio/src/dbusserver.hg
index 276c24e..0c1da01 100644
--- a/gio/src/dbusserver.hg
+++ b/gio/src/dbusserver.hg
@@ -60,6 +60,7 @@ protected:
 public:
 
   _WRAP_METHOD_DOCS_ONLY(g_dbus_server_new_sync)
+  /// @throw Glib::Error.
   static Glib::RefPtr<DBusServer> create_sync(const Glib::ustring& address,
     const Glib::ustring& guid,
     const Glib::RefPtr<DBusAuthObserver>& observer,



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