[glibmm] Add Gio::DBusServer.



commit 53fd3dbf9e04dd042dbeaf075b5d4be9fac6f53e
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Sun Jul 25 22:08:50 2010 -0400

    	Add Gio::DBusServer.
    
    	* gio/src/dbusserver.ccg:
    	* gio/src/dbusserver.hg:
    	* gio/src/filelist.am: Add the new sources for Gio::DBusServer.
    
    	* tools/extra_defs_gen/generate_defs_gio.cc:
    	* gio/src/gio_signals.defs: Add the GDBusServer type to the extra defs
    	generation utility and regenerate the signal defs file to get the
    	signals and properties of GDBusServer.
    
    	* tools/m4/convert_gio.m4: Add conversions for GDBusServer.
    	Alphabetize the enum conversions.
    
    	* gio/src/dbusauthobserver.hg: Typos.

 ChangeLog                                 |   18 +++++++
 gio/src/dbusauthobserver.hg               |    7 +--
 gio/src/dbusserver.ccg                    |   42 ++++++++++++++++
 gio/src/dbusserver.hg                     |   76 +++++++++++++++++++++++++++++
 gio/src/filelist.am                       |    1 +
 gio/src/gio_signals.defs                  |   65 ++++++++++++++++++++++++
 tools/extra_defs_gen/generate_defs_gio.cc |    1 +
 tools/m4/convert_gio.m4                   |   51 +++++++++++---------
 8 files changed, 234 insertions(+), 27 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3b5f0d4..3f6e610 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2010-07-25  José Alburquerque  <jaalburqu svn gnome org>
+
+	Add Gio::DBusServer.
+
+	* gio/src/dbusserver.ccg:
+	* gio/src/dbusserver.hg:
+	* gio/src/filelist.am: Add the new sources for Gio::DBusServer.
+
+	* tools/extra_defs_gen/generate_defs_gio.cc:
+	* gio/src/gio_signals.defs: Add the GDBusServer type to the extra defs
+	generation utility and regenerate the signal defs file to get the
+	signals and properties of GDBusServer.
+
+	* tools/m4/convert_gio.m4: Add conversions for GDBusServer.
+	Alphabetize the enum conversions.
+
+	* gio/src/dbusauthobserver.hg: Typos.
+
 2010-07-25  Murray Cumming  <murrayc murrayc com>
 
 	DBusAuthObserver: Fix the build with latest glib.
diff --git a/gio/src/dbusauthobserver.hg b/gio/src/dbusauthobserver.hg
index f06609c..ddf286b 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 0000000..b0d0ba5
--- /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 0000000..45d00bb
--- /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 5d17069..16c9398 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 8dc10f0..491700a 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
diff --git a/tools/extra_defs_gen/generate_defs_gio.cc b/tools/extra_defs_gen/generate_defs_gio.cc
index 6d1a656..a7477e1 100644
--- a/tools/extra_defs_gen/generate_defs_gio.cc
+++ b/tools/extra_defs_gen/generate_defs_gio.cc
@@ -74,6 +74,7 @@ int main(int, char**)
 
             // network IO classes
             << get_defs(G_TYPE_DBUS_AUTH_OBSERVER)
+            << get_defs(G_TYPE_DBUS_SERVER)
             << get_defs(G_TYPE_INET_ADDRESS)
             << get_defs(G_TYPE_INET_SOCKET_ADDRESS)
             << get_defs(G_TYPE_SOCKET_ADDRESS)
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 4420d33..7470423 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -1,35 +1,36 @@
-_CONV_ENUM(G,PasswordSave)
+_CONV_ENUM(G,AppInfoCreateFlags)
 _CONV_ENUM(G,AskPasswordFlags)
-_CONV_ENUM(G,MountOperationResult)
-_CONV_ENUM(G,MountUnmountFlags)
-_CONV_ENUM(G,MountMountFlags)
-_CONV_ENUM(G,FileAttributeType)
+_CONV_ENUM(G,CredentialsType)
+_CONV_ENUM(G,DataStreamByteOrder)
+_CONV_ENUM(G,DataStreamNewlineType)
+_CONV_ENUM(G,DBusCapabilityFlags)
+_CONV_ENUM(G,DBusMessageFlags)
+_CONV_ENUM(G,DBusMessageHeaderField)
+_CONV_ENUM(G,DBusMessageType)
+_CONV_ENUM(G,DBusSendMessageFlags)
+_CONV_ENUM(G,DBusServerFlags)
+_CONV_ENUM(G,DriveStartFlags)
+_CONV_ENUM(G,DriveStartFlags)
+_CONV_ENUM(G,DriveStartStopType)
+_CONV_ENUM(G,EmblemOrigin)
 _CONV_ENUM(G,FileAttributeInfoFlags)
+_CONV_ENUM(G,FileAttributeType)
 _CONV_ENUM(G,FileCopyFlags)
 _CONV_ENUM(G,FileCreateFlags)
-_CONV_ENUM(G,FileMonitorFlags)
 _CONV_ENUM(G,FileMonitorEvent)
+_CONV_ENUM(G,FileMonitorFlags)
 _CONV_ENUM(G,FileQueryInfoFlags)
 _CONV_ENUM(G,FileType)
+_CONV_ENUM(G,MountMountFlags)
+_CONV_ENUM(G,MountOperationResult)
+_CONV_ENUM(G,MountUnmountFlags)
 _CONV_ENUM(G,OutputStreamSpliceFlags)
-_CONV_ENUM(G,AppInfoCreateFlags)
-_CONV_ENUM(G,DataStreamByteOrder)
-_CONV_ENUM(G,DataStreamNewlineType)
-_CONV_ENUM(G,EmblemOrigin)
+_CONV_ENUM(G,PasswordSave)
+_CONV_ENUM(G,SettingsBindFlags)
 _CONV_ENUM(G,SocketFamily)
-_CONV_ENUM(G,SocketType)
-_CONV_ENUM(G,SocketProtocol)
 _CONV_ENUM(G,SocketMsgFlags)
-_CONV_ENUM(G,DriveStartFlags)
-_CONV_ENUM(G,DriveStartFlags)
-_CONV_ENUM(G,DriveStartStopType)
-_CONV_ENUM(G,SettingsBindFlags)
-_CONV_ENUM(G,CredentialsType)
-_CONV_ENUM(G,DBusCapabilityFlags)
-_CONV_ENUM(G,DBusSendMessageFlags)
-_CONV_ENUM(G,DBusMessageType)
-_CONV_ENUM(G,DBusMessageFlags)
-_CONV_ENUM(G,DBusMessageHeaderField)
+_CONV_ENUM(G,SocketProtocol)
+_CONV_ENUM(G,SocketType)
 
 # AppInfo
 _CONVERSION(`GAppInfo*',`Glib::RefPtr<AppInfo>',`Glib::wrap($3)')
@@ -52,10 +53,15 @@ _CONVERSION(`const Glib::RefPtr<Gio::Cancellable>&',`GCancellable*',__CONVERT_CO
 _CONVERSION(`GCancellable*', `Glib::RefPtr<Cancellable>', `Glib::wrap($3)')
 _CONVERSION(`GCancellable*', `const Glib::RefPtr<Cancellable>&', `Glib::wrap($3)')
 
+# Credentials
 _CONVERSION(`const Glib::RefPtr<const Credentials>&',`GCredentials*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gio::Credentials))
 _CONVERSION(`GCredentials*',`Glib::RefPtr<Credentials>',`Glib::wrap($3)')
 _CONVERSION(`GCredentials*',`Glib::RefPtr<const Credentials>',`Glib::wrap($3)')
 
+# DBusConnection
+_CONVERSION(`const Glib::RefPtr<DBusConnection>&',`GDBusConnection*',__CONVERT_REFPTR_TO_P)
+
+# DBusMessage
 _CONVERSION(`const Glib::RefPtr<DBusMessage>&',`GDBusMessage*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`GDBusMessage*',`Glib::RefPtr<DBusMessage>',`Glib::wrap($3)')
 
@@ -73,7 +79,6 @@ _CONVERSION(`const Glib::RefPtr<const File>&',`GFile*',__CONVERT_CONST_REFPTR_TO
 _CONVERSION(`GFile*',`Glib::RefPtr<File>',`Glib::wrap($3)')
 _CONVERSION(`GFile*',`Glib::RefPtr<const File>',`Glib::wrap($3)')
 
-
 # FileAttribute
 _CONVERSION(`GFileAttributeValue*',`FileAttributeValue',`Glib::wrap($3)')
 _CONVERSION(`const FileAttributeValue&',`const GFileAttributeValue*',`$3.gobj()')



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