[glibmm] Add Gio::DBusMethodInvocation.



commit 9f01782d8fdb14ab0b796f2dacc6e7426f53cc08
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Tue Jul 27 20:12:11 2010 -0400

    	Add Gio::DBusMethodInvocation.
    
    	* gio/src/dbusmethodinvocation.{ccg,hg}:
    	* gio/src/filelist.am: Add source files for Gio::DBusMethodInvocation.
    	* tools/m4/convert_gio.m4: Add necessary conversions.
    	* gio/src/unixfdlist.hg: Add missing @newin{}'s.
    	* gio/src/dbusauthobserver.hg: Typo.

 ChangeLog                        |   10 ++++
 gio/src/dbusauthobserver.hg      |    1 -
 gio/src/dbusmethodinvocation.ccg |   37 +++++++++++++++
 gio/src/dbusmethodinvocation.hg  |   90 ++++++++++++++++++++++++++++++++++++++
 gio/src/filelist.am              |    1 +
 gio/src/unixfdlist.hg            |    4 ++
 tools/m4/convert_gio.m4          |    5 ++-
 7 files changed, 146 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 750d89a..802929d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2010-07-27  José Alburquerque  <jaalburqu svn gnome org>
 
+	Add Gio::DBusMethodInvocation.
+
+	* gio/src/dbusmethodinvocation.{ccg,hg}:
+	* gio/src/filelist.am: Add source files for Gio::DBusMethodInvocation.
+	* tools/m4/convert_gio.m4: Add necessary conversions.
+	* gio/src/unixfdlist.hg: Add missing @newin{}'s.
+	* gio/src/dbusauthobserver.hg: Typo.
+
+2010-07-27  José Alburquerque  <jaalburqu svn gnome org>
+
 	Gio::Message: Wrap several methods.
 
 	* gio/src/dbusmessage.ccg:
diff --git a/gio/src/dbusauthobserver.hg b/gio/src/dbusauthobserver.hg
index ddf286b..13ee4cb 100644
--- a/gio/src/dbusauthobserver.hg
+++ b/gio/src/dbusauthobserver.hg
@@ -27,7 +27,6 @@ _PINCLUDE(glibmm/private/object_p.h)
 namespace Gio
 {
 
-
 //TODO: Add example from the C API docs in class docs.
 /** DBusAuthObserver - Object used for authenticating connections.
  * The DBusAuthObserver type provides a mechanism for participating in how a
diff --git a/gio/src/dbusmethodinvocation.ccg b/gio/src/dbusmethodinvocation.ccg
new file mode 100644
index 0000000..21100ad
--- /dev/null
+++ b/gio/src/dbusmethodinvocation.ccg
@@ -0,0 +1,37 @@
+// -*- 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>
+#include <giomm/dbusconnection.h>
+#include <giomm/dbusmessage.h>
+
+namespace Gio
+{
+
+void DBusMethodInvocation::get_parameters(Glib::VariantBase& value) const
+{
+  GVariant* const g_value = g_dbus_method_invocation_get_parameters(const_cast<GDBusMethodInvocation*>(gobj()));
+
+  if(!g_value)
+    return;
+
+  value.init(g_value, true /* take a reference */);
+}
+
+} // namespace Gio
diff --git a/gio/src/dbusmethodinvocation.hg b/gio/src/dbusmethodinvocation.hg
new file mode 100644
index 0000000..60fa33e
--- /dev/null
+++ b/gio/src/dbusmethodinvocation.hg
@@ -0,0 +1,90 @@
+// -*- 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 <glibmm/object.h>
+#include <glibmm/variant.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gio
+{
+
+class DBusConnection;
+class DBusMessage;
+
+/** DBusMethodInvocation - Object for handling remote calls.
+ * Instances of the DBusMethodInvocation class are used when handling D-Bus
+ * method calls. It provides a way to asynchronously return results and
+ * errors.
+ *
+ * The normal way to obtain a DBusMethodInvocation object is to receive it as
+ * an argument to the SlotMethodCall that was passed to
+ * Gio::DBusConnection::register_object().
+ *
+ * @newin{2,26}
+ */
+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)
+  _WRAP_METHOD(Glib::ustring get_interface_name() const, g_dbus_method_invocation_get_interface_name)
+  _WRAP_METHOD(Glib::ustring get_method_name() const, g_dbus_method_invocation_get_method_name)
+
+  //TODO?:_WRAP_METHOD(const GDBusMethodInfo* get_method_info(), g_dbus_method_invocation_get_method_info)
+
+  _WRAP_METHOD(Glib::RefPtr<DBusConnection> get_connection(), g_dbus_method_invocation_get_connection)
+  _WRAP_METHOD(Glib::RefPtr<const DBusConnection> get_connection() const, g_dbus_method_invocation_get_connection, constversion)
+
+  _WRAP_METHOD(Glib::RefPtr<DBusMessage> get_message(), g_dbus_method_invocation_get_message)
+  _WRAP_METHOD(Glib::RefPtr<const DBusMessage> get_message() const, g_dbus_method_invocation_get_message, constversion)
+
+  /** Gets the parameters of the method invocation.
+   *
+   * @param value The location in which to return the parameters.
+   *
+   * @newin{2,26}
+   */
+  void get_parameters(Glib::VariantBase& value) const;
+  _IGNORE(g_dbus_method_invocation_get_parameters)
+
+  _WRAP_METHOD(void return_value(const Glib::VariantBase& parameters), g_dbus_method_invocation_return_value)
+
+#m4 _CONVERSION(`const Glib::ustring&', `GQuark', `Glib::QueryQuark($3).id()')
+  _WRAP_METHOD(void return_error_literal(const Glib::ustring& domain, int code, const Glib::ustring& message), g_dbus_method_invocation_return_error_literal)
+
+#m4 _CONVERSION(`const Glib::Error&', `const GError*', `$3.gobj()')
+  _WRAP_METHOD(void return_gerror(const Glib::Error& error), g_dbus_method_invocation_return_gerror)
+
+  _WRAP_METHOD(void return_dbus_error(const Glib::ustring& error_name, const Glib::ustring& error_message), g_dbus_method_invocation_return_dbus_error)
+
+  // Ignore vararg methods and ones that don't make sense for C++ API.
+  _IGNORE(g_dbus_method_invocation_return_error,
+    g_dbus_method_invocation_return_error_valist,
+    g_dbus_method_invocation_get_user_data)
+
+};
+
+} // namespace Gio
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 47ebe39..65f905e 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -23,6 +23,7 @@ giomm_files_any_hg =			\
 	dbusauthobserver.hg \
 	dbusconnection.hg \
 	dbusmessage.hg \
+	dbusmethodinvocation.hg \
 	dbusserver.hg \
 	drive.hg			\
 	emblem.hg			\
diff --git a/gio/src/unixfdlist.hg b/gio/src/unixfdlist.hg
index 4870c4e..1824eec 100644
--- a/gio/src/unixfdlist.hg
+++ b/gio/src/unixfdlist.hg
@@ -75,6 +75,8 @@ public:
    * caller must not close them. The array is valid only until list is changed
    * in any way.
    * @return The list of file descriptors.
+   *
+   * @newin{2,26}
    */
   const Glib::ArrayHandle<int> peek_fds() const;
 
@@ -87,6 +89,8 @@ public:
    * The caller is responsible for closing all of the file descriptors. The
    * file descriptors in the array are set to close-on-exec.
    * @return The list of file descriptors.
+   *
+   * @newin{2,26}
    */
   Glib::ArrayHandle<int> steal_fds();
 
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 128a8cb..f0c1b97 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -60,6 +60,7 @@ _CONVERSION(`GCredentials*',`Glib::RefPtr<const Credentials>',`Glib::wrap($3)')
 
 # DBusConnection
 _CONVERSION(`const Glib::RefPtr<DBusConnection>&',`GDBusConnection*',__CONVERT_REFPTR_TO_P)
+_CONVERSION(`GDBusConnection*',`Glib::RefPtr<DBusConnection>',Glib::wrap($3))
 
 # DBusMessage
 _CONVERSION(`const Glib::RefPtr<DBusMessage>&',`GDBusMessage*',__CONVERT_REFPTR_TO_P)
@@ -117,8 +118,10 @@ _CONVERSION(`const Glib::RefPtr<Icon>&',`GIcon*',__CONVERT_CONST_REFPTR_TO_P)
 _CONVERSION(`Glib::RefPtr<Icon>',`GIcon*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`Glib::RefPtr<const Icon>',`GIcon*',__CONVERT_CONST_REFPTR_TO_P)
 
+# Emblem
 _CONVERSION(`const Glib::RefPtr<Emblem>&',`GEmblem*',__CONVERT_CONST_REFPTR_TO_P)
 
+# IOStream
 _CONVERSION(`GIOStream*',`Glib::RefPtr<Gio::IOStream>',`Glib::wrap($3)')
 _CONVERSION(`GIOStream*',`Glib::RefPtr<IOStream>',`Glib::wrap($3)')
 _CONVERSION(`GIOStream*',`Glib::RefPtr<const Gio::IOStream>',`Glib::wrap($3)')
@@ -134,7 +137,7 @@ _CONVERSION(`const Glib::RefPtr<InputStream>&',`GInputStream*',__CONVERT_CONST_R
 _CONVERSION(`const Glib::RefPtr<Gio::InputStream>&',`GInputStream*',__CONVERT_CONST_REFPTR_TO_P)
 _CONVERSION(`GInputStream*',`Glib::RefPtr<InputStream>',`Glib::wrap($3)')
 
-#Mount
+# Mount
 _CONVERSION(`GMount*',`Glib::RefPtr<Mount>',`Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<Mount>&',`GMount*',__CONVERT_CONST_REFPTR_TO_P)
 



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