[glibmm] Bring back Gio::Error registration.



commit 9670cf533be1ad717df6974e800cc3b3a419b780
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Feb 23 12:01:47 2011 +0100

    Bring back Gio::Error registration.
    
      * gio/src/error.[hg|ccg]: Move Gio::DBus::Error to
    * gio/src/dbuserror.[hg|ccg]: and temporarily rename it to Gio::DBusError
    because generate_wrap_init.pl.in is wrapping only on of Gio::Error and
    Gio::DBus::Error. Unfortunately, we need to fix the generation to handle
    this properly even when it is called Gio::DBus::DBusError.

 ChangeLog                  |   10 ++++++++++
 examples/dbus/busserver.cc |    6 +++---
 gio/giomm.h                |    1 +
 gio/src/dbusconnection.ccg |    2 +-
 gio/src/dbusconnection.hg  |    1 -
 gio/src/dbuserror.ccg      |   25 +++++++++++++++++++++++++
 gio/src/dbuserror.hg       |   44 ++++++++++++++++++++++++++++++++++++++++++++
 gio/src/error.hg           |    5 -----
 gio/src/filelist.am        |    1 +
 9 files changed, 85 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 98575d3..2de970e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-02-23  Murray Cumming  <murrayc murrayc com>
+
+	Bring back Gio::Error registration.
+
+  * gio/src/error.[hg|ccg]: Move Gio::DBus::Error to
+	* gio/src/dbuserror.[hg|ccg]: and temporarily rename it to Gio::DBusError 
+	because generate_wrap_init.pl.in is wrapping only on of Gio::Error and 
+	Gio::DBus::Error. Unfortunately, we need to fix the generation to handle 
+	this properly even when it is called Gio::DBus::DBusError.
+
 2011-02-21  Murray Cumming  <murrayc murrayc com>
 
 	Mark some new API.
diff --git a/examples/dbus/busserver.cc b/examples/dbus/busserver.cc
index 3beeca2..534a70b 100644
--- a/examples/dbus/busserver.cc
+++ b/examples/dbus/busserver.cc
@@ -100,7 +100,7 @@ static void on_method_call(const Glib::RefPtr<Gio::DBus::Connection>& connection
     if(!curr_alarm.assign_from_iso8601(time_str))
     {
       // If setting alarm was not successful, return an error.
-      Gio::DBus::Error error(Gio::DBus::Error::INVALID_ARGS,
+      Gio::DBusError error(Gio::DBusError::INVALID_ARGS,
           "Alarm string is not in ISO8601 format.");
       invocation->return_gerror(error);
     }
@@ -144,7 +144,7 @@ static void on_method_call(const Glib::RefPtr<Gio::DBus::Connection>& connection
   else
   {
     // Non-existent method on the interface.
-    Gio::DBus::Error error(Gio::DBus::Error::UNKNOWN_METHOD,
+    Gio::DBusError error(Gio::DBusError::UNKNOWN_METHOD,
       "Method does not exist.");
     invocation->return_gerror(error);
   }
@@ -174,7 +174,7 @@ void on_get_property(Glib::VariantBase& property,
   }
   else
   {
-    throw Gio::DBus::Error(Gio::DBus::Error::FAILED, "Unknown property name.");
+    throw Gio::DBusError(Gio::DBusError::FAILED, "Unknown property name.");
   }
 }
 
diff --git a/gio/giomm.h b/gio/giomm.h
index 12f71c3..28a0a86 100644
--- a/gio/giomm.h
+++ b/gio/giomm.h
@@ -34,6 +34,7 @@
 #include <giomm/dbusaddress.h>
 #include <giomm/dbusauthobserver.h>
 #include <giomm/dbusconnection.h>
+#include <giomm/dbuserror.h>
 #include <giomm/dbuserrorutils.h>
 #include <giomm/dbusintrospection.h>
 #include <giomm/dbusmessage.h>
diff --git a/gio/src/dbusconnection.ccg b/gio/src/dbusconnection.ccg
index eae69e0..17c5e76 100644
--- a/gio/src/dbusconnection.ccg
+++ b/gio/src/dbusconnection.ccg
@@ -21,7 +21,7 @@
 #include <giomm/dbusauthobserver.h>
 #include <giomm/dbusintrospection.h>
 #include <giomm/dbusmethodinvocation.h>
-#include <giomm/error.h>
+#include <giomm/dbuserror.h>
 #include "slot_async.h"
 
 namespace
diff --git a/gio/src/dbusconnection.hg b/gio/src/dbusconnection.hg
index 9a84d32..8c323d9 100644
--- a/gio/src/dbusconnection.hg
+++ b/gio/src/dbusconnection.hg
@@ -32,7 +32,6 @@
 _DEFS(giomm,gio)
 _PINCLUDE(glibmm/private/object_p.h)
 
-//TODO: Use a GDbus namespace, and remove the DBus prefixes.
 namespace Gio
 {
 
diff --git a/gio/src/dbuserror.ccg b/gio/src/dbuserror.ccg
new file mode 100644
index 0000000..555a34b
--- /dev/null
+++ b/gio/src/dbuserror.ccg
@@ -0,0 +1,25 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2010 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gio/gio.h>
+
+namespace Gio
+{
+
+} // namespace Gio
diff --git a/gio/src/dbuserror.hg b/gio/src/dbuserror.hg
new file mode 100644
index 0000000..95f1aa6
--- /dev/null
+++ b/gio/src/dbuserror.hg
@@ -0,0 +1,44 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2010 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/interface_p.h)
+
+namespace Gio
+{
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+//Let the generated friend declaration know what wrap_init() it should refer to.
+//TODO: But the generated friend declaration needs to specify the full namespace too.
+void wrap_init();
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+//TODO: Put this in the DBus namespace and remove the DBus prefix,
+//when we can get the generate friend declaration to be generated correctly.
+//namespace DBus
+//{
+
+//This will be necessary when putting it in the DBus namespace:
+//Add the underscore so this is recognized: GMMPROC_EXTRA_NAMESPACE(DBus)
+_WRAP_GERROR(DBusError, GDBusError, G_DBUS_ERROR, NO_GTYPE)
+
+//} //namespace DBus
+
+} // namespace Gio
+
diff --git a/gio/src/error.hg b/gio/src/error.hg
index f22b153..65bb1c8 100644
--- a/gio/src/error.hg
+++ b/gio/src/error.hg
@@ -43,11 +43,6 @@ namespace Gio
 _WRAP_GERROR(Error, GIOErrorEnum, G_IO_ERROR, NO_GTYPE)
 _WRAP_GERROR(ResolverError, GResolverError, G_RESOLVER_ERROR, NO_GTYPE)
 
-namespace DBus
-{
-_WRAP_GERROR(Error, GDBusError, G_DBUS_ERROR, NO_GTYPE)
-} //namespace DBus
-
 } // namespace Gio
 
 #ifdef GIOMM_SAVED_HOST_NOT_FOUND
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index cf5f7b1..604ec48 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -28,6 +28,7 @@ giomm_files_any_hg =			\
   dbusaddress.hg \
 	dbusauthobserver.hg \
 	dbusconnection.hg \
+	dbuserror.hg \
 	dbuserrorutils.hg \
 	dbusintrospection.hg \
 	dbusmessage.hg \



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