[telepathy-glib/master] tp_asv_set_boxed, tp_asv_set_strv

Davyd Madeley davyd at madeley.id.au
Mon Mar 30 18:16:09 PDT 2009


---
 telepathy-glib/dbus.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++
 telepathy-glib/dbus.h |    3 ++
 2 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/telepathy-glib/dbus.c b/telepathy-glib/dbus.c
index 71a17ec..b3961bf 100644
--- a/telepathy-glib/dbus.c
+++ b/telepathy-glib/dbus.c
@@ -2255,6 +2255,33 @@ tp_asv_get_boxed (const GHashTable *asv,
   return g_value_get_boxed (value);
 }
 
+/**
+ * tp_asv_set_boxed:
+ * @asv: a #GHashTable created with tp_asv_new()
+ * @key: string key
+ * @type: the type of the key's value, which must be derived from %G_TYPE_BOXED
+ * @value: value
+ *
+ * Stores the value in the map.
+ *
+ * The value is stored as a slice-allocated GValue.
+ *
+ * See Also: tp_asv_new(), tp_asv_get_boxed()
+ * Since: UNRELEASED
+ */
+void
+tp_asv_set_boxed (GHashTable *asv,
+                  const gchar *key,
+                  GType type,
+                  gpointer value)
+{
+  g_return_if_fail (asv != NULL);
+  g_return_if_fail (key != NULL);
+  g_return_if_fail (G_TYPE_FUNDAMENTAL (type) == G_TYPE_BOXED);
+
+  g_hash_table_insert (asv, (char *) key,
+                  tp_g_value_slice_new_boxed (type, value));
+}
 
 /**
  * tp_asv_get_strv:
@@ -2290,6 +2317,30 @@ tp_asv_get_strv (const GHashTable *asv,
   return g_value_get_boxed (value);
 }
 
+/**
+ * tp_asv_set_strv:
+ * @asv: a #GHashTable created with tp_asv_new()
+ * @key: string key
+ * @value: a %NULL-terminated string array
+ *
+ * Stores the value in the map.
+ *
+ * The value is stored as a slice-allocated GValue.
+ *
+ * See Also: tp_asv_new(), tp_asv_get_strv()
+ * Since: UNRELEASED
+ */
+void
+tp_asv_set_strv (GHashTable *asv,
+                 const gchar *key,
+                 char **value)
+{
+  g_return_if_fail (asv != NULL);
+  g_return_if_fail (key != NULL);
+
+  g_hash_table_insert (asv, (char *) key,
+                  tp_g_value_slice_new_boxed (G_TYPE_STRV, value));
+}
 
 /**
  * tp_asv_lookup:
diff --git a/telepathy-glib/dbus.h b/telepathy-glib/dbus.h
index 608d99b..7f0c398 100644
--- a/telepathy-glib/dbus.h
+++ b/telepathy-glib/dbus.h
@@ -110,6 +110,8 @@ gboolean tp_asv_get_boolean (const GHashTable *asv, const gchar *key,
 void tp_asv_set_boolean (GHashTable *asv, const gchar *key, gboolean value);
 gpointer tp_asv_get_boxed (const GHashTable *asv, const gchar *key,
     GType type);
+void tp_asv_set_boxed (GHashTable *asv, const gchar *key, GType type,
+    gpointer value);
 const GArray *tp_asv_get_bytes (const GHashTable *asv, const gchar *key);
 void tp_asv_set_bytes (GHashTable *asv, const gchar *key, GArray *value);
 gdouble tp_asv_get_double (const GHashTable *asv, const gchar *key,
@@ -137,6 +139,7 @@ const GValue *tp_asv_lookup (const GHashTable *asv, const gchar *key);
 const gchar * const *
 /* this comment stops gtkdoc denying that this function exists */
 tp_asv_get_strv (const GHashTable *asv, const gchar *key);
+void tp_asv_set_strv (GHashTable *asv, const gchar *key, char **value);
 
 G_END_DECLS
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list