From 7897d019f1a5a4844a2f656b005a57db87324b75 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Sun, 13 Jun 2010 21:02:05 +0300 Subject: ns: listen for "open" signal Signed-off-by: Felipe Contreras --- pn_ns.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pn_ns.c b/pn_ns.c index 1a91acc..0a44c31 100644 --- a/pn_ns.c +++ b/pn_ns.c @@ -7,6 +7,7 @@ static void *parent_class; struct pn_ns_priv { struct pn_session *session; + gulong open_sig_handler; }; enum { @@ -29,6 +30,12 @@ pn_ns_free(struct pn_ns *ns) g_object_unref(ns); } +static void +open_cb(struct pn_ns *self) +{ + /* stub */ +} + /* GObject stuff */ static void @@ -39,6 +46,8 @@ instance_init(GTypeInstance *instance, struct pn_ns_priv *priv = self->priv; self->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE(instance, PN_NS_TYPE, struct pn_ns_priv); + + priv->open_sig_handler = g_signal_connect(self, "open", G_CALLBACK(open_cb), NULL); } static void @@ -77,12 +86,26 @@ set_property(GObject *object, } } +static void +dispose(GObject *obj) +{ + struct pn_ns *self = PN_NS(obj); + struct pn_ns_priv *priv = self->priv; + + if (priv->open_sig_handler) { + g_signal_handler_disconnect(self, priv->open_sig_handler); + priv->open_sig_handler = 0; + } + G_OBJECT_CLASS(parent_class)->dispose(obj); +} + static void class_init(void *g_class, void *class_data) { GObjectClass *gobject_class = G_OBJECT_CLASS(g_class); + gobject_class->dispose = dispose; gobject_class->get_property = get_property; gobject_class->set_property = set_property; -- cgit v1.2.3