[farsight2/master] Create nice agent in FsNiceAgent
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:26:26 PST 2008
---
transmitters/nice/fs-nice-agent.c | 20 +++++++++++++++++++-
transmitters/nice/fs-nice-agent.h | 4 +++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/transmitters/nice/fs-nice-agent.c b/transmitters/nice/fs-nice-agent.c
index d847e2c..ed222e8 100644
--- a/transmitters/nice/fs-nice-agent.c
+++ b/transmitters/nice/fs-nice-agent.c
@@ -83,6 +83,7 @@ struct _FsNiceAgentPrivate
static void fs_nice_agent_class_init (
FsNiceAgentClass *klass);
static void fs_nice_agent_init (FsNiceAgent *self);
+static void fs_nice_agent_dispose (GObject *object);
static void fs_nice_agent_finalize (GObject *object);
static void fs_nice_agent_stop_thread (FsNiceAgent *self);
@@ -138,6 +139,7 @@ fs_nice_agent_class_init (FsNiceAgentClass *klass)
parent_class = g_type_class_peek_parent (klass);
gobject_class->set_property = fs_nice_agent_set_property;
+ gobject_class->dispose = fs_nice_agent_dispose;
gobject_class->finalize = fs_nice_agent_finalize;
g_type_class_add_private (klass, sizeof (FsNiceAgentPrivate));
@@ -169,13 +171,25 @@ fs_nice_agent_init (FsNiceAgent *self)
self->priv->compatibility_mode = NICE_COMPATIBILITY_ID19;
}
+
static void
-fs_nice_agent_finalize (GObject *object)
+fs_nice_agent_dispose (GObject *object)
{
FsNiceAgent *self = FS_NICE_AGENT (object);
fs_nice_agent_stop_thread (self);
+ if (self->agent)
+ g_object_unref (self->agent);
+ self->agent = NULL;
+
+ parent_class->dispose (object);
+}
+static void
+fs_nice_agent_finalize (GObject *object)
+{
+ FsNiceAgent *self = FS_NICE_AGENT (object);
+
if (self->priv->main_context)
{
g_main_context_unref (self->priv->main_context);
@@ -294,6 +308,10 @@ fs_nice_agent_new (guint compatibility_mode, GError **error)
"compatibility-mode", compatibility_mode,
NULL);
+ self->agent = nice_agent_new (&self->priv->udpfactory,
+ self->priv->main_context,
+ self->priv->compatibility_mode);
+
FS_NICE_AGENT_LOCK (self);
self->priv->thread = g_thread_create (fs_nice_agent_main_thread,
diff --git a/transmitters/nice/fs-nice-agent.h b/transmitters/nice/fs-nice-agent.h
index 4a697f7..cefb257 100644
--- a/transmitters/nice/fs-nice-agent.h
+++ b/transmitters/nice/fs-nice-agent.h
@@ -67,13 +67,15 @@ struct _FsNiceAgentClass
/**
* FsNiceAgent:
+ * @agent: The underlying nice agent
*
- * All members are private, access them using methods and properties
*/
struct _FsNiceAgent
{
GObject parent;
+ NiceAgent *agent;
+
/*< private >*/
FsNiceAgentPrivate *priv;
};
--
1.5.6.5
More information about the farsight-commits
mailing list