summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Alburquerque <jaalburqu@svn.gnome.org>2012-03-14 23:58:17 -0400
committerJosé Alburquerque <jaalburqu@svn.gnome.org>2012-03-15 00:00:11 -0400
commit1d9ffe967f87868a261f471e9596c48926f25b1f (patch)
tree6c7708b80420e4eca98c033ea2c55b1e2e5600fa
parentae0481bb3fe643938a5202428cb7662684ba430b (diff)
downloadglibmm-1d9ffe967f87868a261f471e9596c48926f25b1f.tar.gz
Gio::DBus: Add the Interface and Object interfaces.
* gio/src/dbusinterface.{ccg,hg}: * gio/src/dbusobject.{ccg,hg}: * gio/src/filelist.am: Add the new sources and include them in the list of files to be built. * gio/src/gio_vfuncs.defs: Add the virtual function definitions for the new interfaces. * tools/m4/convert_gio.m4: Add conversions for the new interfaces.
-rw-r--r--ChangeLog12
-rw-r--r--gio/src/dbusinterface.ccg27
-rw-r--r--gio/src/dbusinterface.hg75
-rw-r--r--gio/src/dbusobject.ccg27
-rw-r--r--gio/src/dbusobject.hg74
-rw-r--r--gio/src/filelist.am60
-rw-r--r--gio/src/gio_vfuncs.defs99
-rw-r--r--tools/m4/convert_gio.m410
8 files changed, 328 insertions, 56 deletions
diff --git a/ChangeLog b/ChangeLog
index e90d2703..be638cf0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-03-14 José Alburquerque <jaalburquerque@gmail.com>
+
+ Gio::DBus: Add the Interface and Object interfaces.
+
+ * gio/src/dbusinterface.{ccg,hg}:
+ * gio/src/dbusobject.{ccg,hg}:
+ * gio/src/filelist.am: Add the new sources and include them in the
+ list of files to be built.
+ * gio/src/gio_vfuncs.defs: Add the virtual function definitions for
+ the new interfaces.
+ * tools/m4/convert_gio.m4: Add conversions for the new interfaces.
+
2012-03-12 Kjell Ahlstedt <kjell.ahlstedt@bredband.net>
Glib::Threads::Private, Glib::Dispatcher: Delete Glib::DispatchNotifier.
diff --git a/gio/src/dbusinterface.ccg b/gio/src/dbusinterface.ccg
new file mode 100644
index 00000000..af4aa8e4
--- /dev/null
+++ b/gio/src/dbusinterface.ccg
@@ -0,0 +1,27 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2012 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/dbusintrospection.h>
+#include <giomm/dbusobject.h>
+
+namespace Gio
+{
+
+} // namespace Gio
diff --git a/gio/src/dbusinterface.hg b/gio/src/dbusinterface.hg
new file mode 100644
index 00000000..7d414dc5
--- /dev/null
+++ b/gio/src/dbusinterface.hg
@@ -0,0 +1,75 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2012 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/interface.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/interface_p.h)
+_PINCLUDE(gio/gio.h)
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+typedef struct _GDBusInterfaceIface GDBusInterfaceIface;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+namespace Gio
+{
+
+namespace DBus
+{
+
+class InterfaceInfo;
+class Object;
+
+_GMMPROC_EXTRA_NAMESPACE(DBus)
+
+//TODO: Have Proxy derive from this interface when there is an ABI break.
+
+/** Interface - Base type for D-Bus interfaces.
+ * The Interface type is the base type for D-Bus interfaces both on the service
+ * side (see InterfaceSkeleton) and client side (see Proxy).
+ * @newin{2,34}
+ */
+
+class Interface : public Glib::Interface
+{
+ _CLASS_INTERFACE(Interface, GDBusInterface, G_DBUS_INTERFACE, GDBusInterfaceIface)
+
+public:
+ _WRAP_METHOD(Glib::RefPtr<InterfaceInfo> get_info(), g_dbus_interface_get_info)
+ _WRAP_METHOD(Glib::RefPtr<const InterfaceInfo> get_info() const, g_dbus_interface_get_info, constversion)
+ _WRAP_METHOD(Glib::RefPtr<Gio::DBus::Object> get_object(), g_dbus_interface_get_object)
+ _WRAP_METHOD(Glib::RefPtr<const Gio::DBus::Object> get_object() const, g_dbus_interface_get_object, constversion)
+
+ _WRAP_METHOD(Glib::RefPtr<Gio::DBus::Object> dup_object(), g_dbus_interface_dup_object)
+ _WRAP_METHOD(Glib::RefPtr<const Gio::DBus::Object> dup_object() const, g_dbus_interface_dup_object, constversion)
+ _WRAP_METHOD(void set_object(const Glib::RefPtr<Gio::DBus::Object>& object), g_dbus_interface_set_object)
+
+ _WRAP_VFUNC(Glib::RefPtr<InterfaceInfo> get_info() const, "get_info")
+
+ _WRAP_VFUNC(Glib::RefPtr<Gio::DBus::Object> get_object() const, "get_object")
+
+#m4 _CONVERSION(`GDBusObject*',`const Glib::RefPtr<Gio::DBus::Object>&',`Glib::wrap($3, true)')
+ _WRAP_VFUNC(void set_object(const Glib::RefPtr<Gio::DBus::Object>& object), "set_object")
+
+ _WRAP_VFUNC(Glib::RefPtr<Gio::DBus::Object> dup_object() const, "dup_object")
+};
+
+} // namespace DBus
+
+} // namespace Gio
diff --git a/gio/src/dbusobject.ccg b/gio/src/dbusobject.ccg
new file mode 100644
index 00000000..68334dfd
--- /dev/null
+++ b/gio/src/dbusobject.ccg
@@ -0,0 +1,27 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2012 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/dbusinterface.h>
+#include <glibmm/vectorutils.h>
+
+namespace Gio
+{
+
+} // namespace Gio
diff --git a/gio/src/dbusobject.hg b/gio/src/dbusobject.hg
new file mode 100644
index 00000000..3dedefc1
--- /dev/null
+++ b/gio/src/dbusobject.hg
@@ -0,0 +1,74 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2012 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/interface.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/interface_p.h)
+_PINCLUDE(gio/gio.h)
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+typedef struct _GDBusObjectIface GDBusObjectIface;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+namespace Gio
+{
+
+namespace DBus
+{
+
+class Interface;
+
+_GMMPROC_EXTRA_NAMESPACE(DBus)
+
+/** Object - Base type for D-Bus objects.
+ * The Object type is the base type for D-Bus objects on both the service side
+ * (see ObjectSkeleton) and the client side (see ObjectProxy). It is
+ * essentially just a container of interfaces.
+ * @newin{2,34}
+ */
+
+class Object : public Glib::Interface
+{
+ _CLASS_INTERFACE(Object, GDBusObject, G_DBUS_OBJECT, GDBusObjectIface)
+
+public:
+ _WRAP_METHOD(Glib::ustring get_object_path() const, g_dbus_object_get_object_path)
+
+#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Gio::DBus::Interface> >',`Glib::ListHandler< Glib::RefPtr<Gio::DBus::Interface> >::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<Gio::DBus::Interface> > get_interfaces(), g_dbus_object_get_interfaces)
+
+#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<const Gio::DBus::Interface> >',`Glib::ListHandler< Glib::RefPtr<const Gio::DBus::Interface> >::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<const Gio::DBus::Interface> > get_interfaces() const, g_dbus_object_get_interfaces)
+
+ _WRAP_METHOD(Glib::RefPtr<Gio::DBus::Interface> get_interface(const Glib::ustring& interface_name), g_dbus_object_get_interface)
+ _WRAP_METHOD(Glib::RefPtr<const Gio::DBus::Interface> get_interface(const Glib::ustring& interface_name) const, g_dbus_object_get_interface, constversion)
+
+#m4 _CONVERSION(`Glib::ustring',`const gchar*',`$3.c_str()')
+ _WRAP_VFUNC(Glib::ustring get_object_path() const, "get_object_path")
+
+#m4 _CONVERSION(`std::vector< Glib::RefPtr<Gio::DBus::Interface> >',`GList*',`Glib::ListHandler< Glib::RefPtr<Gio::DBus::Interface> >::vector_to_list($3).data()')
+ _WRAP_VFUNC(std::vector< Glib::RefPtr<Gio::DBus::Interface> > get_interfaces() const, "get_interfaces")
+
+ _WRAP_VFUNC(Glib::RefPtr<Gio::DBus::Interface> get_interface(const Glib::ustring& interface_name) const, "get_interface")
+};
+
+} // namespace DBus
+
+} // namespace Gio
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 47cad841..95c1ebe8 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -18,7 +18,7 @@ giomm_files_any_hg = \
actionmap.hg \
appinfo.hg \
application.hg \
- applicationcommandline.hg \
+ applicationcommandline.hg \
asyncinitable.hg \
asyncresult.hg \
bufferedinputstream.hg \
@@ -28,22 +28,24 @@ giomm_files_any_hg = \
datainputstream.hg \
dataoutputstream.hg \
dbusactiongroup.hg \
- dbusaddress.hg \
- dbusauthobserver.hg \
- dbusconnection.hg \
- dbuserror.hg \
- dbuserrorutils.hg \
- dbusinterfacevtable.hg \
- dbusintrospection.hg \
- dbusmenumodel.hg \
- dbusmessage.hg \
- dbusmethodinvocation.hg \
- dbusownname.hg \
- dbusproxy.hg \
- dbusserver.hg \
- dbussubtreevtable.hg \
- dbusutils.hg \
- dbuswatchname.hg \
+ dbusaddress.hg \
+ dbusauthobserver.hg \
+ dbusconnection.hg \
+ dbuserror.hg \
+ dbuserrorutils.hg \
+ dbusinterface.hg \
+ dbusinterfacevtable.hg \
+ dbusintrospection.hg \
+ dbusmenumodel.hg \
+ dbusmessage.hg \
+ dbusmethodinvocation.hg \
+ dbusobject.hg \
+ dbusownname.hg \
+ dbusproxy.hg \
+ dbusserver.hg \
+ dbussubtreevtable.hg \
+ dbusutils.hg \
+ dbuswatchname.hg \
drive.hg \
emblem.hg \
emblemedicon.hg \
@@ -72,16 +74,16 @@ giomm_files_any_hg = \
memoryinputstream.hg \
memoryoutputstream.hg \
menuattributeiter.hg \
- menulinkiter.hg \
- menumodel.hg \
+ menulinkiter.hg \
+ menumodel.hg \
mount.hg \
mountoperation.hg \
networkaddress.hg \
networkservice.hg \
outputstream.hg \
- proxy.hg \
- proxyaddress.hg \
- proxyresolver.hg \
+ proxy.hg \
+ proxyaddress.hg \
+ proxyresolver.hg \
remoteactiongroup.hg \
resolver.hg \
seekable.hg \
@@ -91,14 +93,14 @@ giomm_files_any_hg = \
socket.hg \
socketaddress.hg \
socketaddressenumerator.hg \
- socketclient.hg \
+ socketclient.hg \
socketconnectable.hg \
socketconnection.hg \
- socketcontrolmessage.hg \
+ socketcontrolmessage.hg \
socketlistener.hg \
socketservice.hg \
srvtarget.hg \
- tcpconnection.hg \
+ tcpconnection.hg \
threadedsocketservice.hg \
themedicon.hg \
volume.hg \
@@ -107,11 +109,11 @@ giomm_files_any_hg = \
giomm_files_posix_hg = \
desktopappinfo.hg \
unixconnection.hg \
- unixcredentialsmessage.hg \
- unixfdlist.hg \
- unixfdmessage.hg \
+ unixcredentialsmessage.hg \
+ unixfdlist.hg \
+ unixfdmessage.hg \
unixinputstream.hg \
- unixoutputstream.hg \
+ unixoutputstream.hg \
unixsocketaddress.hg
if HOST_WINDOWS_NATIVE
diff --git a/gio/src/gio_vfuncs.defs b/gio/src/gio_vfuncs.defs
index 6d31ec23..8d9c5660 100644
--- a/gio/src/gio_vfuncs.defs
+++ b/gio/src/gio_vfuncs.defs
@@ -229,6 +229,78 @@
(return-type "GObject*")
)
+; GDBusInterface
+
+(define-vfunc get_info
+ (of-object "GDBusInterface")
+ (return-type "GDBusInterfaceInfo*")
+)
+
+(define-vfunc get_object
+ (of-object "GDBusInterface")
+ (return-type "GDBusObject*")
+)
+
+(define-vfunc set_object
+ (of-object "GDBusInterface")
+ (return-type "void")
+ (parameters
+ '("GDBusObject*" "object")
+ )
+)
+
+(define-vfunc dup_object
+ (of-object "GDBusInterface")
+ (return-type "GDBusObject*")
+)
+
+; GDBusObject
+
+(define-vfunc get_object_path
+ (of-object "GDBusObject")
+ (return-type "const-gchar*")
+)
+
+(define-vfunc get_interfaces
+ (of-object "GDBusObject")
+ (return-type "GList*")
+)
+
+(define-vfunc get_interface
+ (of-object "GDBusObject")
+ (return-type "GDBusInterface*")
+ (parameters
+ '("const-gchar*" "interface_name")
+ )
+)
+
+; GDrive
+
+(define-vfunc get_name
+ (of-object "GDrive")
+ (return-type "char*")
+)
+
+(define-vfunc has_volumes
+ (of-object "GDrive")
+ (return-type "gboolean")
+)
+
+(define-vfunc is_automounted
+ (of-object "GDrive")
+ (return-type "gboolean")
+)
+
+(define-vfunc can_mount
+ (of-object "GDrive")
+ (return-type "gboolean")
+)
+
+(define-vfunc can_eject
+ (of-object "GDrive")
+ (return-type "gboolean")
+)
+
; GFile
(define-vfunc dup
@@ -312,33 +384,6 @@
)
)
-; GDrive
-
-(define-vfunc get_name
- (of-object "GDrive")
- (return-type "char*")
-)
-
-(define-vfunc has_volumes
- (of-object "GDrive")
- (return-type "gboolean")
-)
-
-(define-vfunc is_automounted
- (of-object "GDrive")
- (return-type "gboolean")
-)
-
-(define-vfunc can_mount
- (of-object "GDrive")
- (return-type "gboolean")
-)
-
-(define-vfunc can_eject
- (of-object "GDrive")
- (return-type "gboolean")
-)
-
; GIcon
(define-vfunc hash
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 35446f19..5f6e440b 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -94,8 +94,18 @@ _CONVERSION(`GDBusPropertyInfo*',`Glib::RefPtr<PropertyInfo>',`Glib::wrap($3)')
_CONVERSION(`GDBusNodeInfo*',`Glib::RefPtr<NodeInfo>',`Glib::wrap($3)')
_CONVERSION(`GDBusInterfaceInfo*',`Glib::RefPtr<InterfaceInfo>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<InterfaceInfo>&',`GDBusInterfaceInfo*',`Glib::unwrap($3)')
+_CONVERSION(`Glib::RefPtr<InterfaceInfo>',`GDBusInterfaceInfo*',`Glib::unwrap($3)')
_CONVERSION(`GDBusInterfaceInfo*',`const Glib::RefPtr<InterfaceInfo>',`Glib::wrap($3)')
+# DBusInterface
+_CONVERSION(`GDBusInterface*',`Glib::RefPtr<Gio::DBus::Interface>',`Glib::wrap($3)')
+_CONVERSION(`Glib::RefPtr<Gio::DBus::Interface>',`GDBusInterface*',`Glib::unwrap($3)')
+
+# DBusObject
+_CONVERSION(`GDBusObject*',`Glib::RefPtr<Gio::DBus::Object>',`Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<Gio::DBus::Object>&',`GDBusObject*',`Glib::unwrap($3)')
+_CONVERSION(`Glib::RefPtr<Gio::DBus::Object>',`GDBusObject*',`Glib::unwrap($3)')
+
# DBusProxy
_CONVERSION(`GDBusProxy*',`Glib::RefPtr<Proxy>',`Glib::wrap($3)')