diff options
Diffstat (limited to 'gio/src')
-rw-r--r-- | gio/src/dbusauthobserver.hg | 7 | ||||
-rw-r--r-- | gio/src/dbusserver.ccg | 42 | ||||
-rw-r--r-- | gio/src/dbusserver.hg | 76 | ||||
-rw-r--r-- | gio/src/filelist.am | 1 | ||||
-rw-r--r-- | gio/src/gio_signals.defs | 65 |
5 files changed, 187 insertions, 4 deletions
diff --git a/gio/src/dbusauthobserver.hg b/gio/src/dbusauthobserver.hg index f06609c1..ddf286bb 100644 --- a/gio/src/dbusauthobserver.hg +++ b/gio/src/dbusauthobserver.hg @@ -28,14 +28,13 @@ 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 - * Gio::DBusServer (or a Gio::DBusConnection) authenticates remote peers. - * Simply instantiate a GDBusAuthObserver and connect to the signals you are + * DBusServer (or a DBusConnection) authenticates remote peers. Simply + * instantiate a DBusAuthObserver and connect to the signals you are * interested in. Note that new signals may be added in the future. * - * TODO: Add example from the C API docs. - * * @newin{2,26} */ class DBusAuthObserver : public Glib::Object diff --git a/gio/src/dbusserver.ccg b/gio/src/dbusserver.ccg new file mode 100644 index 00000000..b0d0ba59 --- /dev/null +++ b/gio/src/dbusserver.ccg @@ -0,0 +1,42 @@ +// -*- 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> + +namespace Gio +{ + +DBusServer::DBusServer(const Glib::ustring& address, DBusServerFlags flags, + const Glib::ustring& guid, const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<Cancellable>& cancellable) +{ + init(cancellable); +} + +Glib::RefPtr<DBusServer> DBusServer::create(const Glib::ustring& address, + DBusServerFlags flags, const Glib::ustring& guid, + const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<Cancellable>& cancellable) +{ + return Glib::RefPtr<DBusServer>(new DBusServer(address, flags, guid, + observer, cancellable)); +} + +} // namespace Gio diff --git a/gio/src/dbusserver.hg b/gio/src/dbusserver.hg new file mode 100644 index 00000000..45d00bbb --- /dev/null +++ b/gio/src/dbusserver.hg @@ -0,0 +1,76 @@ +// -*- 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 <giomm/initable.h> + +_DEFS(giomm,gio) +_PINCLUDE(glibmm/private/object_p.h) + +namespace Gio +{ + +_WRAP_ENUM(DBusServerFlags, GDBusServerFlags, NO_GTYPE) + +class DBusAuthObserver; +class DBusConnection; + +//TODO: Add example from the C API in class docs. +/** DBusServer is a helper for listening to and accepting D-Bus connections. + * Since DBusServer implements the Initable interface, its constructors can + * throw an exception if construction fails. + * + * @newin{2,26} + */ +class DBusServer : public Glib::Object, public Initable +{ + _CLASS_GOBJECT(DBusServer, GDBusServer, G_DBUS_SERVER, Glib::Object, GObject) + _IMPLEMENTS_INTERFACE(Initable) + +protected: + DBusServer(const Glib::ustring& address, DBusServerFlags flags, + const Glib::ustring& guid, const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<Cancellable>& cancellable); + +public: + _WRAP_METHOD_DOCS_ONLY(g_dbus_server_new_sync) + static Glib::RefPtr<DBusServer> create(const Glib::ustring& address, + DBusServerFlags flags, const Glib::ustring& guid, + const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<Cancellable>& cancellable); + + _WRAP_METHOD(void start(), g_dbus_server_start) + _WRAP_METHOD(void stop(), g_dbus_server_stop) + _WRAP_METHOD(bool is_active() const, g_dbus_server_is_active) + _WRAP_METHOD(Glib::ustring get_guid() const, g_dbus_server_get_guid) + _WRAP_METHOD(DBusServerFlags get_flags() const, g_dbus_server_get_flags) + _WRAP_METHOD(Glib::ustring get_client_address() const, g_dbus_server_get_client_address) + + _WRAP_PROPERTY("active", Glib::ustring) + _WRAP_PROPERTY("address", Glib::ustring) + _WRAP_PROPERTY("authentication-observer", Glib::RefPtr<DBusAuthObserver>) + _WRAP_PROPERTY("client-address", Glib::ustring) + _WRAP_PROPERTY("flags", DBusServerFlags) + _WRAP_PROPERTY("guid", Glib::ustring) + +#m4 _CONVERSION(`GDBusConnection*', `const Glib::RefPtr<DBusConnection>&', `Glib::wrap($3, true)') + _WRAP_SIGNAL(void new_connection(const Glib::RefPtr<DBusConnection>& connection), "new-connection", no_default_handler) +}; + +} // namespace Gio diff --git a/gio/src/filelist.am b/gio/src/filelist.am index 5d170699..16c9398f 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 \ + dbusserver.hg \ drive.hg \ emblem.hg \ emblemedicon.hg \ diff --git a/gio/src/gio_signals.defs b/gio/src/gio_signals.defs index 8dc10f04..491700a7 100644 --- a/gio/src/gio_signals.defs +++ b/gio/src/gio_signals.defs @@ -676,6 +676,71 @@ ) ) +;; From GDBusServer + +(define-signal new-connection + (of-object "GDBusServer") + (return-type "void") + (when "last") + (parameters + '("GDBusConnection*" "p0") + ) +) + +(define-property address + (of-object "GDBusServer") + (prop-type "GParamString") + (docs "The address to listen on") + (readable #t) + (writable #t) + (construct-only #t) +) + +(define-property client-address + (of-object "GDBusServer") + (prop-type "GParamString") + (docs "The address clients can use") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property flags + (of-object "GDBusServer") + (prop-type "GParamFlags") + (docs "Flags for the server") + (readable #t) + (writable #t) + (construct-only #t) +) + +(define-property guid + (of-object "GDBusServer") + (prop-type "GParamString") + (docs "The guid of the server") + (readable #t) + (writable #t) + (construct-only #t) +) + +(define-property active + (of-object "GDBusServer") + (prop-type "GParamString") + (docs "Whether the server is currently active") + (readable #t) + (writable #f) + (construct-only #f) +) + +(define-property authentication-observer + (of-object "GDBusServer") + (prop-type "GParamObject") + (docs "Object used to assist in the authentication process") + (readable #t) + (writable #t) + (construct-only #t) +) + ;; From GInetAddress (define-property family |