summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2010-07-21 22:59:35 +0200
committerMurray Cumming <murrayc@murrayc.com>2010-07-21 23:04:29 +0200
commit351a3b0a94394be3e2fb0635cdd1f181a9083eac (patch)
tree399dba61e0a5128999e5e906f9373452b905cc51
parent384e0318413f8be5621b46d0156b74dd29616fcc (diff)
downloadglibmm-351a3b0a94394be3e2fb0635cdd1f181a9083eac.tar.gz
giomm: Added Credentials and DBusConnection::get_peer_credentials().
* gio/src/gio_enums.defs: Regenerated. * gio/src/filelist.am: * gio/src/credentials.[hg|ccg]: New wrapper for GCredentials. * gio/src/dbusconnection.hg: Added get_peer_credentials().
-rw-r--r--ChangeLog9
-rw-r--r--gio/src/credentials.ccg25
-rw-r--r--gio/src/credentials.hg61
-rw-r--r--gio/src/dbusconnection.hg11
-rw-r--r--gio/src/filelist.am1
-rw-r--r--gio/src/gio_enums.defs58
-rw-r--r--tools/m4/convert_gio.m46
7 files changed, 163 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 4d731b6b..b8aa2ee5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-07-21 Murray Cumming <murrayc@murrayc-x61>
+
+ giomm: Added Credentials and DBusConnection::get_peer_credentials().
+
+ * gio/src/gio_enums.defs: Regenerated.
+ * gio/src/filelist.am:
+ * gio/src/credentials.[hg|ccg]: New wrapper for GCredentials.
+ * gio/src/dbusconnection.hg: Added get_peer_credentials().
+
2010-07-15 Murray Cumming <murrayc@murrayc.com>
Fix the build for a GDBusConnection API change.
diff --git a/gio/src/credentials.ccg b/gio/src/credentials.ccg
new file mode 100644
index 00000000..555a34bc
--- /dev/null
+++ b/gio/src/credentials.ccg
@@ -0,0 +1,25 @@
+// -*- 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>
+
+namespace Gio
+{
+
+} // namespace Gio
diff --git a/gio/src/credentials.hg b/gio/src/credentials.hg
new file mode 100644
index 00000000..336556b6
--- /dev/null
+++ b/gio/src/credentials.hg
@@ -0,0 +1,61 @@
+// -*- 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>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gio
+{
+
+_WRAP_ENUM(CredentialsType, GCredentialsType, NO_GTYPE)
+
+/** TODO
+ *
+ * @newin{2,26}
+ */
+class Credentials : public Glib::Object
+{
+ _CLASS_GOBJECT(Credentials, GCredentials, G_CREDENTIALS, Glib::Object, GObject)
+
+protected:
+ _CTOR_DEFAULT
+ _IGNORE(g_credentials_new)
+
+public:
+ typedef sigc::slot<void> SlotCancelledCallback;
+
+ _WRAP_CREATE()
+
+ _WRAP_METHOD(Glib::ustring to_string() const, g_credentials_to_string)
+
+ //TODO: _WRAP_METHOD(gpointer get_native(CredentialsType native_type), g_credentials_get_native)
+ //TODO: _WRAP_METHOD(void set_native(CredentialsType native_type, gpointer native), g_credentials_set_native)
+ _WRAP_METHOD(bool is_same_user(const Glib::RefPtr<const Credentials>& other_credentials), g_credentials_is_same_user, errthrow)
+
+#ifdef G_OS_UNIX
+ _WRAP_METHOD(uid_t get_unix_user(), g_credentials_get_unix_user, errthrow)
+ _WRAP_METHOD(bool set_unix_user(uid_t uid), g_credentials_set_unix_user, errthrow)
+#endif //G_OS_UNIX
+};
+
+
+} // namespace Gio
+
diff --git a/gio/src/dbusconnection.hg b/gio/src/dbusconnection.hg
index baf70a1f..0b9ad3e2 100644
--- a/gio/src/dbusconnection.hg
+++ b/gio/src/dbusconnection.hg
@@ -20,6 +20,7 @@
#include <glibmm/object.h>
#include <giomm/iostream.h>
#include <giomm/asyncresult.h>
+#include <giomm/credentials.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
@@ -42,7 +43,7 @@ protected:
public:
_WRAP_METHOD(bool is_closed() const, g_dbus_connection_is_closed)
-
+
//TODO: Documentation.
void close();
@@ -83,13 +84,15 @@ public:
_WRAP_METHOD(void flush_sync(const Glib::RefPtr<Cancellable>& cancellable), g_dbus_connection_flush_sync, errthrow)
-
- _WRAP_METHOD(Glib::RefPtr<Gio::IOStream> get_stream(), g_dbus_connection_get_stream, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<IOStream> get_stream(), g_dbus_connection_get_stream, refreturn)
_WRAP_METHOD(Glib::RefPtr<const IOStream> get_stream() const, g_dbus_connection_get_stream, refreturn, constversion)
_WRAP_METHOD(Glib::ustring get_guid() const, g_dbus_connection_get_guid)
_WRAP_METHOD(Glib::ustring get_unique_name() const, g_dbus_connection_get_unique_name)
- //TODO:_WRAP_METHOD(GCredentials *g_dbus_connection_get_peer_credentials(), g_dbus_connection_get_peer_credentials )
+
+ _WRAP_METHOD(Glib::RefPtr<Credentials> get_peer_credentials(), g_dbus_connection_get_peer_credentials, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Credentials> get_peer_credentials() const, g_dbus_connection_get_peer_credentials, refreturn, constversion)
+
_WRAP_METHOD(bool get_exit_on_close() const, g_dbus_connection_get_exit_on_close)
_WRAP_METHOD(void set_exit_on_close(bool exit_on_close = true), g_dbus_connection_set_exit_on_close)
_WRAP_METHOD(DBusCapabilityFlags get_capabilities() const, g_dbus_connection_get_capabilities)
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 207039de..536beac5 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -17,6 +17,7 @@ giomm_files_any_hg = \
bufferedinputstream.hg \
bufferedoutputstream.hg \
cancellable.hg \
+ credentials.hg \
datainputstream.hg \
dataoutputstream.hg \
dbusconnection.hg \
diff --git a/gio/src/gio_enums.defs b/gio/src/gio_enums.defs
index b7db98e0..8beb0452 100644
--- a/gio/src/gio_enums.defs
+++ b/gio/src/gio_enums.defs
@@ -2,9 +2,10 @@
;; Original typedef:
;; typedef enum {
-;; G_APP_INFO_CREATE_NONE = 0, /*< nick=none >*/
-;; G_APP_INFO_CREATE_NEEDS_TERMINAL = (1 << 0), /*< nick=needs-terminal >*/
-;; G_APP_INFO_CREATE_SUPPORTS_URIS = (1 << 1) /*< nick=supports-uris >*/
+;; G_APP_INFO_CREATE_NONE = 0, /*< nick=none >*/
+;; G_APP_INFO_CREATE_NEEDS_TERMINAL = (1 << 0), /*< nick=needs-terminal >*/
+;; G_APP_INFO_CREATE_SUPPORTS_URIS = (1 << 1), /*< nick=supports-uris >*/
+;; G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION = (1 << 2) /*< nick=supports-startup-notification >*/
;; } GAppInfoCreateFlags;
(define-flags-extended AppInfoCreateFlags
@@ -14,6 +15,7 @@
'("none" "G_APP_INFO_CREATE_NONE" "0x0")
'("needs-terminal" "G_APP_INFO_CREATE_NEEDS_TERMINAL" "(1 << 0)")
'("supports-uris" "G_APP_INFO_CREATE_SUPPORTS_URIS" "(1 << 1)")
+ '("supports-startup-notification" "G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION" "(1 << 2)")
)
)
@@ -848,7 +850,8 @@
;; G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT = (1<<0),
;; G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER = (1<<1),
;; G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS = (1<<2),
-;; G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION = (1<<3)
+;; G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION = (1<<3),
+;; G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING = (1<<4)
;; } GDBusConnectionFlags;
(define-flags-extended DBusConnectionFlags
@@ -860,6 +863,7 @@
'("authentication-server" "G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER" "(1<<1)")
'("authentication-allow-anonymous" "G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS" "(1<<2)")
'("message-bus-connection" "G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION" "(1<<3)")
+ '("delay-message-processing" "G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING" "(1<<4)")
)
)
@@ -1014,6 +1018,52 @@
)
)
+;; Original typedef:
+;; typedef enum /*< flags >*/
+;; {
+;; G_DBUS_SIGNAL_FLAGS_NONE = 0,
+;; } GDBusSignalFlags;
+
+(define-flags-extended DBusSignalFlags
+ (in-module "G")
+ (c-name "GDBusSignalFlags")
+ (values
+ '("us-signal-flags-none" "G_DBUS_SIGNAL_FLAGS_NONE" "0x0")
+ )
+)
+
+;; Original typedef:
+;; typedef enum
+;; {
+;; G_DBUS_SEND_MESSAGE_FLAGS_NONE = 0,
+;; G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL = (1<<0)
+;; } GDBusSendMessageFlags;
+
+(define-flags-extended DBusSendMessageFlags
+ (in-module "G")
+ (c-name "GDBusSendMessageFlags")
+ (values
+ '("none" "G_DBUS_SEND_MESSAGE_FLAGS_NONE" "0x0")
+ '("preserve-serial" "G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL" "(1<<0)")
+ )
+)
+
+;; Original typedef:
+;; typedef enum
+;; {
+;; G_CREDENTIALS_TYPE_INVALID,
+;; G_CREDENTIALS_TYPE_LINUX_UCRED
+;; } GCredentialsType;
+
+(define-enum-extended CredentialsType
+ (in-module "G")
+ (c-name "GCredentialsType")
+ (values
+ '("invalid" "G_CREDENTIALS_TYPE_INVALID" "0")
+ '("linux-ucred" "G_CREDENTIALS_TYPE_LINUX_UCRED" "1")
+ )
+)
+
;; From gsettings.h
;; Original typedef:
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 6d1cabfb..ef8c808c 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -48,6 +48,10 @@ _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)')
+_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)')
+
# DesktopAppInfo
_CONVERSION(`GDesktopAppInfo*', `Glib::RefPtr<DesktopAppInfo>', `Glib::wrap($3)')
@@ -103,7 +107,9 @@ _CONVERSION(`Glib::RefPtr<const Icon>',`GIcon*',__CONVERT_CONST_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Emblem>&',`GEmblem*',__CONVERT_CONST_REFPTR_TO_P)
_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)')
+_CONVERSION(`GIOStream*',`Glib::RefPtr<const IOStream>',`Glib::wrap($3)')
# InetAddress
_CONVERSION(`const Glib::RefPtr<InetAddress>&',`GInetAddress*',__CONVERT_CONST_REFPTR_TO_P)