[Telepathy-commits] [telepathy-gabble/master] util: add gabble_g_value_slice_new_uint and a family of equivalents for strings

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Mar 4 04:20:52 PST 2009


---
 src/util.c |   36 ++++++++++++++++++++++++++++++++++++
 src/util.h |    5 +++++
 2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/src/util.c b/src/util.c
index 1ab99f4..811cb38 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1015,3 +1015,39 @@ gabble_signal_connect_weak (gpointer instance,
   g_object_weak_ref (instance_obj, instance_destroyed_cb, ctx);
   g_object_weak_ref (user_data, user_data_destroyed_cb, ctx);
 }
+
+GValue *
+gabble_g_value_slice_new_uint (guint n)
+{
+  GValue *value = tp_g_value_slice_new (G_TYPE_UINT);
+
+  g_value_set_uint (value, n);
+  return value;
+}
+
+GValue *
+gabble_g_value_slice_new_string (const gchar *string)
+{
+  GValue *value = tp_g_value_slice_new (G_TYPE_STRING);
+
+  g_value_set_string (value, string);
+  return value;
+}
+
+GValue *
+gabble_g_value_slice_new_static_string (const gchar *string)
+{
+  GValue *value = tp_g_value_slice_new (G_TYPE_STRING);
+
+  g_value_set_static_string (value, string);
+  return value;
+}
+
+GValue *
+gabble_g_value_slice_new_take_string (gchar *string)
+{
+  GValue *value = tp_g_value_slice_new (G_TYPE_STRING);
+
+  g_value_take_string (value, string);
+  return value;
+}
diff --git a/src/util.h b/src/util.h
index c581e49..ff4e851 100644
--- a/src/util.h
+++ b/src/util.h
@@ -84,4 +84,9 @@ lm_iq_message_make_result (LmMessage *iq_message);
 void gabble_signal_connect_weak (gpointer instance, const gchar *detailed_signal,
     GCallback c_handler, GObject *user_data);
 
+GValue *gabble_g_value_slice_new_uint (guint n);
+GValue *gabble_g_value_slice_new_string (const gchar *string);
+GValue *gabble_g_value_slice_new_static_string (const gchar *string);
+GValue *gabble_g_value_slice_new_take_string (gchar *string);
+
 #endif /* __GABBLE_UTIL_H__ */
-- 
1.5.6.5



More information about the telepathy-commits mailing list