aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimo.cecchi@collabora.co.uk>2009-02-05 05:07:04 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-02-05 05:07:04 +0800
commitc82a53228231370c30aa8d7791e40db93eb4b931 (patch)
tree076b835809d2c8531cefb79ccbe56f51280644ab /libempathy
parent057c97bbffaf8c0bfb9813b51324cc925cc5656a (diff)
downloadgsoc2013-empathy-c82a53228231370c30aa8d7791e40db93eb4b931.tar
gsoc2013-empathy-c82a53228231370c30aa8d7791e40db93eb4b931.tar.gz
gsoc2013-empathy-c82a53228231370c30aa8d7791e40db93eb4b931.tar.bz2
gsoc2013-empathy-c82a53228231370c30aa8d7791e40db93eb4b931.tar.lz
gsoc2013-empathy-c82a53228231370c30aa8d7791e40db93eb4b931.tar.xz
gsoc2013-empathy-c82a53228231370c30aa8d7791e40db93eb4b931.tar.zst
gsoc2013-empathy-c82a53228231370c30aa8d7791e40db93eb4b931.zip
Cleanup for GObject related functions in EmpathyCallFactory and EmpathyCallHandler.
From: Cosimo Cecchi <cosimo.cecchi@collabora.co.uk> svn path=/trunk/; revision=2426
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-call-factory.c79
-rw-r--r--libempathy/empathy-call-factory.h1
-rw-r--r--libempathy/empathy-call-handler.c108
-rw-r--r--libempathy/empathy-call-handler.h1
4 files changed, 86 insertions, 103 deletions
diff --git a/libempathy/empathy-call-factory.c b/libempathy/empathy-call-factory.c
index 565f1d03f..08d35f0c2 100644
--- a/libempathy/empathy-call-factory.c
+++ b/libempathy/empathy-call-factory.c
@@ -24,6 +24,7 @@
#include "empathy-marshal.h"
#include "empathy-call-factory.h"
+#include "empathy-utils.h"
G_DEFINE_TYPE(EmpathyCallFactory, empathy_call_factory, G_TYPE_OBJECT)
@@ -37,30 +38,23 @@ enum
static guint signals[LAST_SIGNAL] = {0};
/* private structure */
-typedef struct _EmpathyCallFactoryPrivate EmpathyCallFactoryPrivate;
-
-struct _EmpathyCallFactoryPrivate
-{
+typedef struct {
gboolean dispose_has_run;
-};
+} EmpathyCallFactoryPriv;
-#define EMPATHY_CALL_FACTORY_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
- EMPATHY_TYPE_CALL_FACTORY, EmpathyCallFactoryPrivate))
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyCallFactory)
+
+static GObject *call_factory = NULL;
static void
empathy_call_factory_init (EmpathyCallFactory *obj)
{
- //EmpathyCallFactoryPrivate *priv = EMPATHY_CALL_FACTORY_GET_PRIVATE (obj);
+ EmpathyCallFactoryPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (obj,
+ EMPATHY_TYPE_CALL_FACTORY, EmpathyCallFactoryPriv);
- /* allocate any data required by the object here */
+ obj->priv = priv;
}
-static void empathy_call_factory_dispose (GObject *object);
-static void empathy_call_factory_finalize (GObject *object);
-
-static GObject *call_factory = NULL;
-
static GObject *
empathy_call_factory_constructor (GType type, guint n_construct_params,
GObjectConstructParam *construct_params)
@@ -75,33 +69,18 @@ empathy_call_factory_constructor (GType type, guint n_construct_params,
}
static void
-empathy_call_factory_class_init (
- EmpathyCallFactoryClass *empathy_call_factory_class)
+empathy_call_factory_finalize (GObject *object)
{
- GObjectClass *object_class = G_OBJECT_CLASS (empathy_call_factory_class);
-
- g_type_class_add_private (empathy_call_factory_class,
- sizeof (EmpathyCallFactoryPrivate));
-
- object_class->constructor = empathy_call_factory_constructor;
- object_class->dispose = empathy_call_factory_dispose;
- object_class->finalize = empathy_call_factory_finalize;
+ /* free any data held directly by the object here */
- signals[NEW_CALL_HANDLER] =
- g_signal_new ("new-call-handler",
- G_TYPE_FROM_CLASS (empathy_call_factory_class),
- G_SIGNAL_RUN_LAST, 0,
- NULL, NULL,
- _empathy_marshal_VOID__OBJECT_BOOLEAN,
- G_TYPE_NONE,
- 2, EMPATHY_TYPE_CALL_HANDLER, G_TYPE_BOOLEAN);
+ if (G_OBJECT_CLASS (empathy_call_factory_parent_class)->finalize)
+ G_OBJECT_CLASS (empathy_call_factory_parent_class)->finalize (object);
}
-void
+static void
empathy_call_factory_dispose (GObject *object)
{
- EmpathyCallFactory *self = EMPATHY_CALL_FACTORY (object);
- EmpathyCallFactoryPrivate *priv = EMPATHY_CALL_FACTORY_GET_PRIVATE (self);
+ EmpathyCallFactoryPriv *priv = GET_PRIV (object);
if (priv->dispose_has_run)
return;
@@ -114,15 +93,27 @@ empathy_call_factory_dispose (GObject *object)
G_OBJECT_CLASS (empathy_call_factory_parent_class)->dispose (object);
}
-void
-empathy_call_factory_finalize (GObject *object)
+static void
+empathy_call_factory_class_init (
+ EmpathyCallFactoryClass *empathy_call_factory_class)
{
- //EmpathyCallFactory *self = EMPATHY_CALL_FACTORY (object);
- //EmpathyCallFactoryPrivate *priv = EMPATHY_CALL_FACTORY_GET_PRIVATE (self);
+ GObjectClass *object_class = G_OBJECT_CLASS (empathy_call_factory_class);
- /* free any data held directly by the object here */
+ g_type_class_add_private (empathy_call_factory_class,
+ sizeof (EmpathyCallFactoryPriv));
- G_OBJECT_CLASS (empathy_call_factory_parent_class)->finalize (object);
+ object_class->constructor = empathy_call_factory_constructor;
+ object_class->dispose = empathy_call_factory_dispose;
+ object_class->finalize = empathy_call_factory_finalize;
+
+ signals[NEW_CALL_HANDLER] =
+ g_signal_new ("new-call-handler",
+ G_TYPE_FROM_CLASS (empathy_call_factory_class),
+ G_SIGNAL_RUN_LAST, 0,
+ NULL, NULL,
+ _empathy_marshal_VOID__OBJECT_BOOLEAN,
+ G_TYPE_NONE,
+ 2, EMPATHY_TYPE_CALL_HANDLER, G_TYPE_BOOLEAN);
}
EmpathyCallFactory *
@@ -152,7 +143,7 @@ empathy_call_factory_new_call (EmpathyCallFactory *factory,
handler = empathy_call_handler_new_for_contact (contact);
- g_signal_emit (G_OBJECT (factory), signals[NEW_CALL_HANDLER], 0,
+ g_signal_emit (factory, signals[NEW_CALL_HANDLER], 0,
handler, TRUE);
g_object_unref (handler);
@@ -175,7 +166,7 @@ empathy_call_factory_claim_channel (EmpathyCallFactory *factory,
empathy_dispatch_operation_claim (operation);
/* FIXME should actually look at the channel */
- g_signal_emit (G_OBJECT (factory), signals[NEW_CALL_HANDLER], 0,
+ g_signal_emit (factory, signals[NEW_CALL_HANDLER], 0,
handler, FALSE);
g_object_unref (handler);
diff --git a/libempathy/empathy-call-factory.h b/libempathy/empathy-call-factory.h
index 181a51496..13b16b692 100644
--- a/libempathy/empathy-call-factory.h
+++ b/libempathy/empathy-call-factory.h
@@ -37,6 +37,7 @@ struct _EmpathyCallFactoryClass {
struct _EmpathyCallFactory {
GObject parent;
+ gpointer priv;
};
GType empathy_call_factory_get_type (void);
diff --git a/libempathy/empathy-call-handler.c b/libempathy/empathy-call-handler.c
index a6117cd19..40abf0d60 100644
--- a/libempathy/empathy-call-handler.c
+++ b/libempathy/empathy-call-handler.c
@@ -30,12 +30,12 @@
#include "empathy-call-handler.h"
#include "empathy-dispatcher.h"
#include "empathy-marshal.h"
+#include "empathy-utils.h"
G_DEFINE_TYPE(EmpathyCallHandler, empathy_call_handler, G_TYPE_OBJECT)
/* signal enum */
-enum
-{
+enum {
CONFERENCE_ADDED,
SRC_PAD_ADDED,
SINK_PAD_ADDED,
@@ -51,31 +51,66 @@ enum {
};
/* private structure */
-typedef struct _EmpathyCallHandlerPriv EmpathyCallHandlerPriv;
-struct _EmpathyCallHandlerPriv
-{
+typedef struct {
gboolean dispose_has_run;
EmpathyTpCall *call;
EmpathyContact *contact;
TfChannel *tfchannel;
GstBus *bus;
-};
+} EmpathyCallHandlerPriv;
-#define GET_PRIV(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), EMPATHY_TYPE_CALL_HANDLER,\
- EmpathyCallHandlerPriv))
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyCallHandler)
static void
-empathy_call_handler_init (EmpathyCallHandler *obj)
+empathy_call_handler_dispose (GObject *object)
{
- //EmpathyCallHandlerPriv *priv = GET_PRIV (obj);
+ EmpathyCallHandlerPriv *priv = GET_PRIV (object);
+
+ if (priv->dispose_has_run)
+ return;
+
+ priv->dispose_has_run = TRUE;
+
+ if (priv->contact != NULL)
+ g_object_unref (priv->contact);
+
+ priv->contact = NULL;
+
+ if (priv->tfchannel != NULL)
+ g_object_unref (priv->tfchannel);
+
+ priv->tfchannel = NULL;
- /* allocate any data required by the object here */
+ if (priv->call != NULL)
+ {
+ empathy_tp_call_close (priv->call);
+ g_object_unref (priv->call);
+ }
+
+ priv->call = NULL;
+
+ /* release any references held by the object here */
+ if (G_OBJECT_CLASS (empathy_call_handler_parent_class)->dispose)
+ G_OBJECT_CLASS (empathy_call_handler_parent_class)->dispose (object);
}
-static void empathy_call_handler_dispose (GObject *object);
-static void empathy_call_handler_finalize (GObject *object);
+static void
+empathy_call_handler_finalize (GObject *object)
+{
+ /* free any data held directly by the object here */
+ if (G_OBJECT_CLASS (empathy_call_handler_parent_class)->finalize)
+ G_OBJECT_CLASS (empathy_call_handler_parent_class)->finalize (object);
+}
+
+static void
+empathy_call_handler_init (EmpathyCallHandler *obj)
+{
+ EmpathyCallHandlerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (obj,
+ EMPATHY_TYPE_CALL_HANDLER, EmpathyCallHandlerPriv);
+
+ obj->priv = priv;
+}
static void
empathy_call_handler_set_property (GObject *object,
@@ -175,51 +210,6 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass)
2, GST_TYPE_PAD, G_TYPE_UINT);
}
-void
-empathy_call_handler_dispose (GObject *object)
-{
- EmpathyCallHandler *self = EMPATHY_CALL_HANDLER (object);
- EmpathyCallHandlerPriv *priv = GET_PRIV (self);
-
- if (priv->dispose_has_run)
- return;
-
- priv->dispose_has_run = TRUE;
-
- if (priv->contact != NULL)
- g_object_unref (priv->contact);
-
- priv->contact = NULL;
-
- if (priv->tfchannel != NULL)
- g_object_unref (priv->tfchannel);
-
- priv->tfchannel = NULL;
-
- if (priv->call != NULL)
- {
- empathy_tp_call_close (priv->call);
- g_object_unref (priv->call);
- }
-
- priv->call = NULL;
-
- /* release any references held by the object here */
- if (G_OBJECT_CLASS (empathy_call_handler_parent_class)->dispose)
- G_OBJECT_CLASS (empathy_call_handler_parent_class)->dispose (object);
-}
-
-void
-empathy_call_handler_finalize (GObject *object)
-{
- //EmpathyCallHandler *self = EMPATHY_CALL_HANDLER (object);
- //EmpathyCallHandlerPriv *priv = GET_PRIV (self);
-
- /* free any data held directly by the object here */
-
- G_OBJECT_CLASS (empathy_call_handler_parent_class)->finalize (object);
-}
-
EmpathyCallHandler *
empathy_call_handler_new_for_contact (EmpathyContact *contact)
{
diff --git a/libempathy/empathy-call-handler.h b/libempathy/empathy-call-handler.h
index 1986b8b87..4bea0037c 100644
--- a/libempathy/empathy-call-handler.h
+++ b/libempathy/empathy-call-handler.h
@@ -39,6 +39,7 @@ struct _EmpathyCallHandlerClass {
struct _EmpathyCallHandler {
GObject parent;
+ gpointer priv;
};
GType empathy_call_handler_get_type (void);