[Telepathy-commits] [telepathy-glib/master] callable example: emit a signal when presence changes to available
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Mar 18 06:21:33 PDT 2009
This can be used to trigger a simulated incoming call.
---
examples/cm/callable/conn.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/examples/cm/callable/conn.c b/examples/cm/callable/conn.c
index 34a3530..027cc0b 100644
--- a/examples/cm/callable/conn.c
+++ b/examples/cm/callable/conn.c
@@ -50,6 +50,14 @@ enum
N_PROPS
};
+enum
+{
+ SIGNAL_AVAILABLE,
+ N_SIGNALS
+};
+
+static guint signals[N_SIGNALS] = { 0 };
+
struct _ExampleCallableConnectionPrivate
{
gchar *account;
@@ -333,6 +341,12 @@ set_own_status (GObject *object,
(gpointer) status);
tp_presence_mixin_emit_presence_update (object, presences);
g_hash_table_destroy (presences);
+
+ if (!self->priv->away)
+ {
+ g_signal_emit (self, signals[SIGNAL_AVAILABLE], 0, message);
+ }
+
return TRUE;
}
@@ -392,6 +406,13 @@ example_callable_connection_class_init (
g_object_class_install_property (object_class, PROP_SIMULATION_DELAY,
param_spec);
+ /* Used in the media manager, to simulate an incoming call when we become
+ * available */
+ signals[SIGNAL_AVAILABLE] = g_signal_new ("available",
+ G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
+
tp_contacts_mixin_class_init (object_class,
G_STRUCT_OFFSET (ExampleCallableConnectionClass, contacts_mixin));
tp_presence_mixin_class_init (object_class,
--
1.5.6.5
More information about the telepathy-commits
mailing list