diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-05-03 18:26:24 +0100 |
---|---|---|
committer | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2010-06-29 20:29:29 -0300 |
commit | f3e5b1593eb303fbda3b0a8eabed667d6ed2991c (patch) | |
tree | 2b3b3ae9971908686de7948bca04800f21b3c5ae /telepathy-glib/base-protocol.h | |
parent | d95c55350c9ae457832df80abb60a6af5bdbe9ae (diff) | |
download | telepathy-glib-f3e5b1593eb303fbda3b0a8eabed667d6ed2991c.tar.gz |
Add stub base-protocol.[ch] and move some TpCMParamSpec functionality there
_tp_cm_param_spec_to_dbus is new code, which streamlines the conversion
between a TpCMParamSpec and the Param_Spec (susv) struct used on D-Bus;
the rest has been moved without changes.
Diffstat (limited to 'telepathy-glib/base-protocol.h')
-rw-r--r-- | telepathy-glib/base-protocol.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/telepathy-glib/base-protocol.h b/telepathy-glib/base-protocol.h new file mode 100644 index 000000000..456fd6aa6 --- /dev/null +++ b/telepathy-glib/base-protocol.h @@ -0,0 +1,71 @@ +/* TpBaseProtocol + * + * Copyright © 2007-2010 Collabora Ltd. + * Copyright © 2007-2009 Nokia Corporation + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef TP_BASE_PROTOCOL_H +#define TP_BASE_PROTOCOL_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +typedef struct _TpCMParamSpec TpCMParamSpec; + +typedef void (*TpCMParamSetter) (const TpCMParamSpec *paramspec, + const GValue *value, gpointer params); + +typedef gboolean (*TpCMParamFilter) (const TpCMParamSpec *paramspec, + GValue *value, GError **error); + +gboolean tp_cm_param_filter_string_nonempty (const TpCMParamSpec *paramspec, + GValue *value, GError **error); + +gboolean tp_cm_param_filter_uint_nonzero (const TpCMParamSpec *paramspec, + GValue *value, GError **error); + +/* XXX: This should be driven by GTypes, but the GType is insufficiently + * descriptive: if it's UINT we can't tell whether the D-Bus type is + * UInt32, UInt16 or possibly even Byte. So we have the D-Bus type too. + * + * As it stands at the moment it could be driven by the *D-Bus* type, but + * in future we may want to have more than one possible GType for a D-Bus + * type, e.g. converting arrays of string into either a strv or a GPtrArray. + * So, we keep the redundancy for future expansion. + */ + +struct _TpCMParamSpec { + const gchar *name; + const gchar *dtype; + GType gtype; + guint flags; + gconstpointer def; + gsize offset; + + TpCMParamFilter filter; + gconstpointer filter_data; + + gconstpointer setter_data; + + /*<private>*/ + gpointer _future1; +}; + +G_END_DECLS + +#endif |