[glibmm] Add Gio::DBus::ObjectProxy and Gio::DBus::ObjectSkeleton



commit f6f3a028f217533d64c472680f1dbeb96d30968c
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Wed Jul 17 14:58:36 2019 +0200

    Add Gio::DBus::ObjectProxy and Gio::DBus::ObjectSkeleton
    
    In preparation for adding Gio::DBus::ObjectManager, ObjectManagerClient
    and ObjectManagerServer. See issue #43.

 gio/giomm.h                    |  2 +
 gio/src/dbusobjectproxy.ccg    | 17 +++++++++
 gio/src/dbusobjectproxy.hg     | 71 ++++++++++++++++++++++++++++++++++++
 gio/src/dbusobjectskeleton.ccg | 17 +++++++++
 gio/src/dbusobjectskeleton.hg  | 83 ++++++++++++++++++++++++++++++++++++++++++
 gio/src/filelist.am            |  2 +
 tools/m4/convert_gio.m4        |  4 +-
 7 files changed, 195 insertions(+), 1 deletion(-)
---
diff --git a/gio/giomm.h b/gio/giomm.h
index 2c64215a..a72ef3fc 100644
--- a/gio/giomm.h
+++ b/gio/giomm.h
@@ -55,6 +55,8 @@
 #include <giomm/dbusmessage.h>
 #include <giomm/dbusmethodinvocation.h>
 #include <giomm/dbusobject.h>
+#include <giomm/dbusobjectproxy.h>
+#include <giomm/dbusobjectskeleton.h>
 #include <giomm/dbusownname.h>
 #include <giomm/dbusproxy.h>
 #include <giomm/dbusserver.h>
diff --git a/gio/src/dbusobjectproxy.ccg b/gio/src/dbusobjectproxy.ccg
new file mode 100644
index 00000000..eb1c2b1c
--- /dev/null
+++ b/gio/src/dbusobjectproxy.ccg
@@ -0,0 +1,17 @@
+/* Copyright (C) 2019 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gio/gio.h>
diff --git a/gio/src/dbusobjectproxy.hg b/gio/src/dbusobjectproxy.hg
new file mode 100644
index 00000000..755b4fc9
--- /dev/null
+++ b/gio/src/dbusobjectproxy.hg
@@ -0,0 +1,71 @@
+/* Copyright (C) 2019 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glibmm/object.h>
+#include <giomm/dbusobject.h>
+#include <giomm/dbusconnection.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gio
+{
+
+namespace DBus
+{
+//The GMMPROC_EXTRA_NAMESPACE() macro is a hint to generate_wrap_init.pl to put it in the DBus sub-namespace
+_GMMPROC_EXTRA_NAMESPACE(DBus)
+
+/** Client-side D-Bus object.
+ *
+ * A %Gio::DBus::ObjectProxy is an object used to represent a remote object
+ * with one or more D-Bus interfaces. Normally, you don't instantiate
+ * a %Gio::DBus::ObjectProxy yourself - typically Gio::DBus::ObjectManagerClient
+ * is used to obtain it.
+ *
+ * @newin{2,62}
+ * @ingroup DBus
+ */
+class ObjectProxy : public Glib::Object, public Object
+{
+  _CLASS_GOBJECT(ObjectProxy, GDBusObjectProxy, G_DBUS_OBJECT_PROXY, Glib::Object, GObject)
+  _IMPLEMENTS_INTERFACE(DBus::Object)
+
+protected:
+  _WRAP_CTOR(ObjectProxy(const Glib::RefPtr<Connection>& connection,
+    const Glib::ustring& object_path), g_dbus_object_proxy_new)
+
+public:
+  /** Creates a new %Gio::DBus::ObjectProxy for the given connection and
+   * object path.
+   *
+   * @param connection A %Gio::DBus::Connection.
+   * @param object_path The object path.
+   * @return A new %Gio::DBus::ObjectProxy.
+   */
+  _WRAP_CREATE(const Glib::RefPtr<Connection>& connection, const Glib::ustring& object_path)
+
+  _WRAP_METHOD(Glib::RefPtr<Connection> get_connection(), g_dbus_object_proxy_get_connection, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Connection> get_connection() const,
+    g_dbus_object_proxy_get_connection, refreturn, constversion)
+
+ _WRAP_PROPERTY("g-connection", Glib::RefPtr<Connection>)
+ _WRAP_PROPERTY("g-object-path", Glib::ustring)
+};
+
+} //namespace
+
+} // namespace Gio
diff --git a/gio/src/dbusobjectskeleton.ccg b/gio/src/dbusobjectskeleton.ccg
new file mode 100644
index 00000000..eb1c2b1c
--- /dev/null
+++ b/gio/src/dbusobjectskeleton.ccg
@@ -0,0 +1,17 @@
+/* Copyright (C) 2019 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gio/gio.h>
diff --git a/gio/src/dbusobjectskeleton.hg b/gio/src/dbusobjectskeleton.hg
new file mode 100644
index 00000000..41197da9
--- /dev/null
+++ b/gio/src/dbusobjectskeleton.hg
@@ -0,0 +1,83 @@
+/* Copyright (C) 2019 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glibmm/object.h>
+#include <giomm/dbusobject.h>
+#include <giomm/dbusinterfaceskeleton.h>
+#include <giomm/dbusmethodinvocation.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gio
+{
+
+namespace DBus
+{
+//The GMMPROC_EXTRA_NAMESPACE() macro is a hint to generate_wrap_init.pl to put it in the DBus sub-namespace
+_GMMPROC_EXTRA_NAMESPACE(DBus)
+
+/** Service-side D-Bus object.
+ *
+ * A %Gio::DBus::ObjectSkeleton instance is essentially a group of D-Bus
+ * interfaces. The set of exported interfaces on the object may be
+ * dynamic and change at runtime.
+ *
+ * This type is intended to be used with Gio::DBus::ObjectManager.
+ *
+ * @newin{2,62}
+ * @ingroup DBus
+ */
+class ObjectSkeleton : public Glib::Object, public Object
+{
+  _CLASS_GOBJECT(ObjectSkeleton, GDBusObjectSkeleton, G_DBUS_OBJECT_SKELETON, Glib::Object, GObject)
+  _IMPLEMENTS_INTERFACE(DBus::Object)
+
+protected:
+  _WRAP_CTOR(ObjectSkeleton(const Glib::ustring& object_path), g_dbus_object_skeleton_new)
+
+public:
+  /** Creates a new %Gio::DBus::ObjectSkeleton.
+   *
+   * @param object_path An object path.
+   * @return A new %Gio::DBus::ObjectSkeleton.
+   */
+  _WRAP_CREATE(const Glib::ustring& object_path)
+
+  // The parameter name 'interface' can cause compilation errors with MinGW.
+  // See https://bugzilla.gnome.org/show_bug.cgi?id=735137
+  // The parameter names in glib are 'interface_' and 'interface'.
+  _WRAP_METHOD(void flush(), g_dbus_object_skeleton_flush)
+  _WRAP_METHOD(void add_interface(const Glib::RefPtr<Gio::DBus::InterfaceSkeleton>& iface),
+    g_dbus_object_skeleton_add_interface)
+  _WRAP_METHOD(void remove_interface(const Glib::RefPtr<Gio::DBus::InterfaceSkeleton>& iface),
+    g_dbus_object_skeleton_remove_interface)
+  _WRAP_METHOD(void remove_interface(const Glib::ustring& interface_name),
+    g_dbus_object_skeleton_remove_interface_by_name)
+  _WRAP_METHOD(void set_object_path(const Glib::ustring& object_path),
+    g_dbus_object_skeleton_set_object_path)
+
+ _WRAP_PROPERTY("g-object-path", Glib::ustring)
+
+#m4 _CONVERSION(`GDBusInterfaceSkeleton*',`const 
Glib::RefPtr<Gio::DBus::InterfaceSkeleton>&',`Glib::wrap($3, true)')
+#m4 _CONVERSION(`GDBusMethodInvocation*',`const Glib::RefPtr<Gio::DBus::MethodInvocation>&',`Glib::wrap($3, 
true)')
+ _WRAP_SIGNAL(bool authorize_method(const Glib::RefPtr<Gio::DBus::InterfaceSkeleton>& iface,
+   const Glib::RefPtr<Gio::DBus::MethodInvocation>& invocation), "authorize-method")
+};
+
+} //namespace
+
+} // namespace Gio
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 548125c2..18a0eaf2 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -44,6 +44,8 @@ giomm_files_any_hg =                  \
        dbusmessage.hg                  \
        dbusmethodinvocation.hg         \
        dbusobject.hg                   \
+       dbusobjectproxy.hg \
+       dbusobjectskeleton.hg \
        dbusownname.hg                  \
        dbusproxy.hg                    \
        dbusserver.hg                   \
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index b42dea09..7ee92379 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -152,13 +152,15 @@ _CONVERSION(`const Glib::RefPtr<InterfaceInfo>&',`GDBusInterfaceInfo*',`Glib::un
 _CONVERSION(`Glib::RefPtr<InterfaceInfo>',`GDBusInterfaceInfo*',`Glib::unwrap($3)')
 _CONVERSION(`GDBusInterfaceInfo*',`const Glib::RefPtr<InterfaceInfo>',`Glib::wrap($3)')
 
-# DBusInterface
+# DBusInterface, DBusInterfaceSkeleton
 _CONVERSION(`GDBusInterface*',`Glib::RefPtr<Gio::DBus::Interface>',`Glib::wrap($3)')
 _CONVERSION(`Glib::RefPtr<Gio::DBus::Interface>',`GDBusInterface*',`Glib::unwrap($3)')
 _CONVERSION(`const Glib::RefPtr<Gio::DBus::Interface>&',`GDBusInterface*',`Glib::unwrap($3)')
+_CONVERSION(`const Glib::RefPtr<Gio::DBus::InterfaceSkeleton>&',`GDBusInterfaceSkeleton*',`Glib::unwrap($3)')
 
 # DBusMethodInvocation
 _CONVERSION(`const Glib::RefPtr<MethodInvocation>&',`GDBusMethodInvocation*',`Glib::unwrap($3)')
+_CONVERSION(`const Glib::RefPtr<Gio::DBus::MethodInvocation>&',`GDBusMethodInvocation*',`Glib::unwrap($3)')
 
 # DBusObject
 _CONVERSION(`GDBusObject*',`Glib::RefPtr<Gio::DBus::Object>',`Glib::wrap($3)')


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