diff options
author | Murray Cumming <murrayc@murrayc.com> | 2011-02-16 11:24:48 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2011-02-16 11:24:48 +0100 |
commit | ce84ddbd917364c61d50c3921c1f32fdde9f6698 (patch) | |
tree | f7edab1c58ddfa10d1dfc97f72d70df261f13c4e /gio/src/dbuserrorutils.hg | |
parent | eeafcc8933bc078523f6836652c25b4f3db67783 (diff) | |
download | glibmm-ce84ddbd917364c61d50c3921c1f32fdde9f6698.tar.gz |
gmmproc: Allow some classes to be in a sub-namespace.
* tools/m4/class_shared.m4:
* tools/generate_wrap_init.pl.in: Add a _GMMPROC_EXTRA_NAMESPACE(thenamespace)
macro, so that wrap_init.cc will have the correct pre-declarations of the
wrap_new() and get_type() functions.
I am suprised that we have no other way to do this already, but I cannot
find one, and this hack works.
For instance, this lets use put some classes in a Gio::DBus namespace.
Diffstat (limited to 'gio/src/dbuserrorutils.hg')
-rw-r--r-- | gio/src/dbuserrorutils.hg | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/gio/src/dbuserrorutils.hg b/gio/src/dbuserrorutils.hg new file mode 100644 index 00000000..f7f8707d --- /dev/null +++ b/gio/src/dbuserrorutils.hg @@ -0,0 +1,75 @@ +// -*- 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. + */ + +_DEFS(giomm,gio) + +namespace Gio +{ + +namespace DBus +{ + +namespace Error +{ + +/** Checks if @a error represents an error received via D-Bus from a remote + * peer. If so, use get_remote_error() to get the name of the error. + * + * @param error A Glib::Error. + * @return <tt>true</tt> if error represents an error from a remote peer, + * <tt>false</tt> otherwise. + * @newin{2,28} + * @ingroup DBus + */ +bool is_remote_error(const Glib::Error& error); + +/** Gets the D-Bus error name used for @a error, if any. + * + * This function is guaranteed to return a D-Bus error name for all + * Glib::Error instances returned from functions handling remote method calls + * (e.g. Gio::DBusConnection::call_finish()) unless strip_remote_error() has + * been used on @a error. + * + * @param error A Glib::Error. + * @return An allocated string or <tt>0</tt> if the D-Bus error name could not + * be found. + * @newin{2,28} + * @ingroup DBus + */ +Glib::ustring get_remote_error(const Glib::Error& error); + +/** Looks for extra information in the error message used to recover the D-Bus + * error name and strips it if found. If stripped, the message field in @a + * error will correspond exactly to what was received on the wire. + * + * This is typically used when presenting errors to the end user. + * + * @param error A Glib::Error. + * @return <tt>true</tt> if information was stripped, <tt>false</tt> + * otherwise. + * @newin{2,28} + * @ingroup DBus + */ +bool strip_remote_error(Glib::Error& error); + +} // namespace Error + +} // namespace DBus + +} // namespace Gio |