aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-05-06 04:34:41 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-05-06 04:34:41 +0800
commit1557095113a3c0f5baadcfb1e953d73762e5263e (patch)
tree6af706fb1f4f673120981e033768a09169544c11 /libempathy
parent62828fac680bd53e0047d9ae2a281c864075c809 (diff)
downloadgsoc2013-empathy-1557095113a3c0f5baadcfb1e953d73762e5263e.tar
gsoc2013-empathy-1557095113a3c0f5baadcfb1e953d73762e5263e.tar.gz
gsoc2013-empathy-1557095113a3c0f5baadcfb1e953d73762e5263e.tar.bz2
gsoc2013-empathy-1557095113a3c0f5baadcfb1e953d73762e5263e.tar.lz
gsoc2013-empathy-1557095113a3c0f5baadcfb1e953d73762e5263e.tar.xz
gsoc2013-empathy-1557095113a3c0f5baadcfb1e953d73762e5263e.tar.zst
gsoc2013-empathy-1557095113a3c0f5baadcfb1e953d73762e5263e.zip
Keep a priv pointer in the object struct instead of using G_TYPE_INSTANCE_GET_PRIVATE all the time.
svn path=/trunk/; revision=1082
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-chatroom-manager.c14
-rw-r--r--libempathy/empathy-chatroom-manager.h2
-rw-r--r--libempathy/empathy-chatroom.c14
-rw-r--r--libempathy/empathy-chatroom.h2
-rw-r--r--libempathy/empathy-contact-factory.c15
-rw-r--r--libempathy/empathy-contact-factory.h2
-rw-r--r--libempathy/empathy-contact-manager.c16
-rw-r--r--libempathy/empathy-contact-manager.h4
-rw-r--r--libempathy/empathy-contact.c15
-rw-r--r--libempathy/empathy-contact.h1
-rw-r--r--libempathy/empathy-idle.c32
-rw-r--r--libempathy/empathy-idle.h2
-rw-r--r--libempathy/empathy-irc-network-manager.c91
-rw-r--r--libempathy/empathy-irc-network-manager.h1
-rw-r--r--libempathy/empathy-irc-network.c52
-rw-r--r--libempathy/empathy-irc-network.h9
-rw-r--r--libempathy/empathy-irc-server.c34
-rw-r--r--libempathy/empathy-irc-server.h5
-rw-r--r--libempathy/empathy-log-manager.c22
-rw-r--r--libempathy/empathy-log-manager.h2
-rw-r--r--libempathy/empathy-message.c118
-rw-r--r--libempathy/empathy-message.h55
-rw-r--r--libempathy/empathy-tp-call.c20
-rw-r--r--libempathy/empathy-tp-call.h5
-rw-r--r--libempathy/empathy-tp-chat.c24
-rw-r--r--libempathy/empathy-tp-chat.h4
-rw-r--r--libempathy/empathy-tp-contact-factory.c15
-rw-r--r--libempathy/empathy-tp-contact-factory.h2
-rw-r--r--libempathy/empathy-tp-contact-list.c14
-rw-r--r--libempathy/empathy-tp-contact-list.h4
-rw-r--r--libempathy/empathy-tp-group.c15
-rw-r--r--libempathy/empathy-tp-group.h4
-rw-r--r--libempathy/empathy-tp-roomlist.c15
-rw-r--r--libempathy/empathy-tp-roomlist.h4
-rw-r--r--libempathy/empathy-tp-tube.c15
-rw-r--r--libempathy/empathy-tp-tube.h1
-rw-r--r--libempathy/empathy-utils.h1
37 files changed, 281 insertions, 370 deletions
diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c
index 80c190bd9..b9eef3c09 100644
--- a/libempathy/empathy-chatroom-manager.c
+++ b/libempathy/empathy-chatroom-manager.c
@@ -37,17 +37,14 @@
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
#include "empathy-debug.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CHATROOM_MANAGER, EmpathyChatroomManagerPriv))
-
#define CHATROOMS_XML_FILENAME "chatrooms.xml"
#define CHATROOMS_DTD_FILENAME "empathy-chatroom-manager.dtd"
-struct _EmpathyChatroomManagerPriv {
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyChatroomManager)
+typedef struct {
GList *chatrooms;
-};
+} EmpathyChatroomManagerPriv;
-static void empathy_chatroom_manager_class_init (EmpathyChatroomManagerClass *klass);
-static void empathy_chatroom_manager_init (EmpathyChatroomManager *manager);
static void chatroom_manager_finalize (GObject *object);
static gboolean chatroom_manager_get_all (EmpathyChatroomManager *manager);
static gboolean chatroom_manager_file_parse (EmpathyChatroomManager *manager,
@@ -99,9 +96,10 @@ empathy_chatroom_manager_class_init (EmpathyChatroomManagerClass *klass)
static void
empathy_chatroom_manager_init (EmpathyChatroomManager *manager)
{
- EmpathyChatroomManagerPriv *priv;
+ EmpathyChatroomManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
+ EMPATHY_TYPE_CHATROOM_MANAGER, EmpathyChatroomManagerPriv);
- priv = GET_PRIV (manager);
+ manager->priv = priv;
}
static void
diff --git a/libempathy/empathy-chatroom-manager.h b/libempathy/empathy-chatroom-manager.h
index 88c3967c2..0b21b6509 100644
--- a/libempathy/empathy-chatroom-manager.h
+++ b/libempathy/empathy-chatroom-manager.h
@@ -42,10 +42,10 @@ G_BEGIN_DECLS
typedef struct _EmpathyChatroomManager EmpathyChatroomManager;
typedef struct _EmpathyChatroomManagerClass EmpathyChatroomManagerClass;
-typedef struct _EmpathyChatroomManagerPriv EmpathyChatroomManagerPriv;
struct _EmpathyChatroomManager {
GObject parent;
+ gpointer priv;
};
struct _EmpathyChatroomManagerClass {
diff --git a/libempathy/empathy-chatroom.c b/libempathy/empathy-chatroom.c
index 7b4a3d672..17be191e5 100644
--- a/libempathy/empathy-chatroom.c
+++ b/libempathy/empathy-chatroom.c
@@ -28,17 +28,15 @@
#include "empathy-chatroom.h"
#include "empathy-utils.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CHATROOM, EmpathyChatroomPriv))
-
-struct _EmpathyChatroomPriv {
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyChatroom)
+typedef struct {
McAccount *account;
gchar *room;
gchar *name;
gboolean auto_connect;
-};
+} EmpathyChatroomPriv;
+
-static void empathy_chatroom_class_init (EmpathyChatroomClass *klass);
-static void empathy_chatroom_init (EmpathyChatroom *chatroom);
static void chatroom_finalize (GObject *object);
static void chatroom_get_property (GObject *object,
guint param_id,
@@ -107,6 +105,10 @@ empathy_chatroom_class_init (EmpathyChatroomClass *klass)
static void
empathy_chatroom_init (EmpathyChatroom *chatroom)
{
+ EmpathyChatroomPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (chatroom,
+ EMPATHY_TYPE_CHATROOM, EmpathyChatroomPriv);
+
+ chatroom->priv = priv;
}
static void
diff --git a/libempathy/empathy-chatroom.h b/libempathy/empathy-chatroom.h
index 2f46cf146..58e2e53d7 100644
--- a/libempathy/empathy-chatroom.h
+++ b/libempathy/empathy-chatroom.h
@@ -39,10 +39,10 @@ G_BEGIN_DECLS
typedef struct _EmpathyChatroom EmpathyChatroom;
typedef struct _EmpathyChatroomClass EmpathyChatroomClass;
-typedef struct _EmpathyChatroomPriv EmpathyChatroomPriv;
struct _EmpathyChatroom {
GObject parent;
+ gpointer priv;
};
struct _EmpathyChatroomClass {
diff --git a/libempathy/empathy-contact-factory.c b/libempathy/empathy-contact-factory.c
index e9469bac9..2169e7108 100644
--- a/libempathy/empathy-contact-factory.c
+++ b/libempathy/empathy-contact-factory.c
@@ -24,15 +24,10 @@
#include "empathy-contact-factory.h"
#include "empathy-utils.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- EMPATHY_TYPE_CONTACT_FACTORY, EmpathyContactFactoryPriv))
-
-struct _EmpathyContactFactoryPriv {
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyContactFactory)
+typedef struct {
GHashTable *accounts;
-};
-
-static void empathy_contact_factory_class_init (EmpathyContactFactoryClass *klass);
-static void empathy_contact_factory_init (EmpathyContactFactory *factory);
+} EmpathyContactFactoryPriv;
G_DEFINE_TYPE (EmpathyContactFactory, empathy_contact_factory, G_TYPE_OBJECT);
@@ -153,8 +148,10 @@ empathy_contact_factory_class_init (EmpathyContactFactoryClass *klass)
static void
empathy_contact_factory_init (EmpathyContactFactory *factory)
{
- EmpathyContactFactoryPriv *priv = GET_PRIV (factory);
+ EmpathyContactFactoryPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (factory,
+ EMPATHY_TYPE_CONTACT_FACTORY, EmpathyContactFactoryPriv);
+ factory->priv = priv;
priv->accounts = g_hash_table_new_full (empathy_account_hash,
empathy_account_equal,
g_object_unref,
diff --git a/libempathy/empathy-contact-factory.h b/libempathy/empathy-contact-factory.h
index 9ff8d3fa9..24fec0e03 100644
--- a/libempathy/empathy-contact-factory.h
+++ b/libempathy/empathy-contact-factory.h
@@ -40,10 +40,10 @@ G_BEGIN_DECLS
typedef struct _EmpathyContactFactory EmpathyContactFactory;
typedef struct _EmpathyContactFactoryClass EmpathyContactFactoryClass;
-typedef struct _EmpathyContactFactoryPriv EmpathyContactFactoryPriv;
struct _EmpathyContactFactory {
GObject parent;
+ gpointer priv;
};
struct _EmpathyContactFactoryClass {
diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c
index cb7fcadc9..48ac1598b 100644
--- a/libempathy/empathy-contact-manager.c
+++ b/libempathy/empathy-contact-manager.c
@@ -32,17 +32,13 @@
#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
#include "empathy-debug.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- EMPATHY_TYPE_CONTACT_MANAGER, EmpathyContactManagerPriv))
-
-struct _EmpathyContactManagerPriv {
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyContactManager)
+typedef struct {
GHashTable *lists;
MissionControl *mc;
gpointer token;
-};
+} EmpathyContactManagerPriv;
-static void empathy_contact_manager_class_init (EmpathyContactManagerClass *klass);
-static void empathy_contact_manager_init (EmpathyContactManager *manager);
static void contact_manager_iface_init (EmpathyContactListIface *iface);
G_DEFINE_TYPE_WITH_CODE (EmpathyContactManager, empathy_contact_manager, G_TYPE_OBJECT,
@@ -208,11 +204,11 @@ empathy_contact_manager_class_init (EmpathyContactManagerClass *klass)
static void
empathy_contact_manager_init (EmpathyContactManager *manager)
{
- EmpathyContactManagerPriv *priv;
GSList *accounts, *l;
+ EmpathyContactManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
+ EMPATHY_TYPE_CONTACT_MANAGER, EmpathyContactManagerPriv);
- priv = GET_PRIV (manager);
-
+ manager->priv = priv;
priv->lists = g_hash_table_new_full (empathy_account_hash,
empathy_account_equal,
(GDestroyNotify) g_object_unref,
diff --git a/libempathy/empathy-contact-manager.h b/libempathy/empathy-contact-manager.h
index 811a7b79d..e55f0c17d 100644
--- a/libempathy/empathy-contact-manager.h
+++ b/libempathy/empathy-contact-manager.h
@@ -40,10 +40,10 @@ G_BEGIN_DECLS
typedef struct _EmpathyContactManager EmpathyContactManager;
typedef struct _EmpathyContactManagerClass EmpathyContactManagerClass;
-typedef struct _EmpathyContactManagerPriv EmpathyContactManagerPriv;
struct _EmpathyContactManager {
- GObject parent;
+ GObject parent;
+ gpointer priv;
};
struct _EmpathyContactManagerClass {
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 639cd9388..19283cc72 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -38,11 +38,8 @@
#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
#include "empathy-debug.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CONTACT, EmpathyContactPriv))
-
-typedef struct _EmpathyContactPriv EmpathyContactPriv;
-
-struct _EmpathyContactPriv {
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyContact)
+typedef struct {
gchar *id;
gchar *name;
EmpathyAvatar *avatar;
@@ -54,10 +51,8 @@ struct _EmpathyContactPriv {
gboolean is_user;
guint hash;
EmpathyContactReady ready;
-};
+} EmpathyContactPriv;
-static void empathy_contact_class_init (EmpathyContactClass *class);
-static void empathy_contact_init (EmpathyContact *contact);
static void contact_finalize (GObject *object);
static void contact_get_property (GObject *object,
guint param_id,
@@ -186,6 +181,10 @@ empathy_contact_class_init (EmpathyContactClass *class)
static void
empathy_contact_init (EmpathyContact *contact)
{
+ EmpathyContactPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (contact,
+ EMPATHY_TYPE_CONTACT, EmpathyContactPriv);
+
+ contact->priv = priv;
}
static void
diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h
index a2adbac45..4abca99bd 100644
--- a/libempathy/empathy-contact.h
+++ b/libempathy/empathy-contact.h
@@ -47,6 +47,7 @@ typedef struct _EmpathyContactClass EmpathyContactClass;
struct _EmpathyContact {
GObject parent;
+ gpointer priv;
};
struct _EmpathyContactClass {
diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c
index 7da1a00e6..3363c5046 100644
--- a/libempathy/empathy-idle.c
+++ b/libempathy/empathy-idle.c
@@ -36,21 +36,11 @@
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
#include "empathy-debug.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- EMPATHY_TYPE_IDLE, EmpathyIdlePriv))
-
/* Number of seconds before entering extended autoaway. */
#define EXT_AWAY_TIME (30*60)
-typedef enum {
- NM_STATE_UNKNOWN,
- NM_STATE_ASLEEP,
- NM_STATE_CONNECTING,
- NM_STATE_CONNECTED,
- NM_STATE_DISCONNECTED
-} NMState;
-
-struct _EmpathyIdlePriv {
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyIdle)
+typedef struct {
MissionControl *mc;
DBusGProxy *gs_proxy;
DBusGProxy *nm_proxy;
@@ -69,10 +59,16 @@ struct _EmpathyIdlePriv {
gboolean is_idle;
gboolean nm_connected;
guint ext_away_timeout;
-};
+} EmpathyIdlePriv;
+
+typedef enum {
+ NM_STATE_UNKNOWN,
+ NM_STATE_ASLEEP,
+ NM_STATE_CONNECTING,
+ NM_STATE_CONNECTED,
+ NM_STATE_DISCONNECTED
+} NMState;
-static void empathy_idle_class_init (EmpathyIdleClass *klass);
-static void empathy_idle_init (EmpathyIdle *idle);
static void idle_finalize (GObject *object);
static void idle_get_property (GObject *object,
guint param_id,
@@ -162,12 +158,12 @@ empathy_idle_class_init (EmpathyIdleClass *klass)
static void
empathy_idle_init (EmpathyIdle *idle)
{
- EmpathyIdlePriv *priv;
DBusGConnection *system_bus;
GError *error = NULL;
+ EmpathyIdlePriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (idle,
+ EMPATHY_TYPE_IDLE, EmpathyIdlePriv);
- priv = GET_PRIV (idle);
-
+ idle->priv = priv;
priv->is_idle = FALSE;
priv->mc = empathy_mission_control_new ();
priv->state = mission_control_get_presence_actual (priv->mc, NULL);
diff --git a/libempathy/empathy-idle.h b/libempathy/empathy-idle.h
index 33f1d492e..fbaab36a9 100644
--- a/libempathy/empathy-idle.h
+++ b/libempathy/empathy-idle.h
@@ -37,10 +37,10 @@ G_BEGIN_DECLS
typedef struct _EmpathyIdle EmpathyIdle;
typedef struct _EmpathyIdleClass EmpathyIdleClass;
-typedef struct _EmpathyIdlePriv EmpathyIdlePriv;
struct _EmpathyIdle {
GObject parent;
+ gpointer priv;
};
struct _EmpathyIdleClass {
diff --git a/libempathy/empathy-irc-network-manager.c b/libempathy/empathy-irc-network-manager.c
index e919d9cbb..1c0fe773f 100644
--- a/libempathy/empathy-irc-network-manager.c
+++ b/libempathy/empathy-irc-network-manager.c
@@ -36,21 +36,8 @@
#define IRC_NETWORKS_DTD_FILENAME "empathy-irc-networks.dtd"
#define SAVE_TIMER 4
-G_DEFINE_TYPE (EmpathyIrcNetworkManager, empathy_irc_network_manager,
- G_TYPE_OBJECT);
-
-/* properties */
-enum
-{
- PROP_GLOBAL_FILE = 1,
- PROP_USER_FILE,
- LAST_PROPERTY
-};
-
-typedef struct _EmpathyIrcNetworkManagerPrivate
- EmpathyIrcNetworkManagerPrivate;
-
-struct _EmpathyIrcNetworkManagerPrivate {
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyIrcNetworkManager)
+typedef struct {
GHashTable *networks;
gchar *global_file;
@@ -63,10 +50,18 @@ struct _EmpathyIrcNetworkManagerPrivate {
gboolean loading;
/* source id of the autosave timer */
gint save_timer_id;
+} EmpathyIrcNetworkManagerPriv;
+
+/* properties */
+enum
+{
+ PROP_GLOBAL_FILE = 1,
+ PROP_USER_FILE,
+ LAST_PROPERTY
};
-#define EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE(obj)\
- ((EmpathyIrcNetworkManagerPrivate *) obj->priv)
+G_DEFINE_TYPE (EmpathyIrcNetworkManager, empathy_irc_network_manager,
+ G_TYPE_OBJECT);
static void irc_network_manager_load_servers (
EmpathyIrcNetworkManager *manager);
@@ -83,8 +78,7 @@ empathy_irc_network_manager_get_property (GObject *object,
GParamSpec *pspec)
{
EmpathyIrcNetworkManager *self = EMPATHY_IRC_NETWORK_MANAGER (object);
- EmpathyIrcNetworkManagerPrivate *priv =
- EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ EmpathyIrcNetworkManagerPriv *priv = GET_PRIV (self);
switch (property_id)
{
@@ -107,8 +101,7 @@ empathy_irc_network_manager_set_property (GObject *object,
GParamSpec *pspec)
{
EmpathyIrcNetworkManager *self = EMPATHY_IRC_NETWORK_MANAGER (object);
- EmpathyIrcNetworkManagerPrivate *priv =
- EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ EmpathyIrcNetworkManagerPriv *priv = GET_PRIV (self);
switch (property_id)
{
@@ -148,8 +141,7 @@ static void
empathy_irc_network_manager_finalize (GObject *object)
{
EmpathyIrcNetworkManager *self = EMPATHY_IRC_NETWORK_MANAGER (object);
- EmpathyIrcNetworkManagerPrivate *priv =
- EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ EmpathyIrcNetworkManagerPriv *priv = GET_PRIV (self);
if (priv->save_timer_id > 0)
{
@@ -172,8 +164,8 @@ empathy_irc_network_manager_finalize (GObject *object)
static void
empathy_irc_network_manager_init (EmpathyIrcNetworkManager *self)
{
- EmpathyIrcNetworkManagerPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- EMPATHY_TYPE_IRC_NETWORK_MANAGER, EmpathyIrcNetworkManagerPrivate);
+ EmpathyIrcNetworkManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ EMPATHY_TYPE_IRC_NETWORK_MANAGER, EmpathyIrcNetworkManagerPriv);
self->priv = priv;
@@ -197,8 +189,7 @@ empathy_irc_network_manager_class_init (EmpathyIrcNetworkManagerClass *klass)
object_class->get_property = empathy_irc_network_manager_get_property;
object_class->set_property = empathy_irc_network_manager_set_property;
- g_type_class_add_private (object_class,
- sizeof (EmpathyIrcNetworkManagerPrivate));
+ g_type_class_add_private (object_class, sizeof (EmpathyIrcNetworkManagerPriv));
object_class->finalize = empathy_irc_network_manager_finalize;
@@ -255,8 +246,7 @@ empathy_irc_network_manager_new (const gchar *global_file,
static gboolean
save_timeout (EmpathyIrcNetworkManager *self)
{
- EmpathyIrcNetworkManagerPrivate *priv =
- EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ EmpathyIrcNetworkManagerPriv *priv = GET_PRIV (self);
priv->save_timer_id = 0;
irc_network_manager_file_save (self);
@@ -267,8 +257,7 @@ save_timeout (EmpathyIrcNetworkManager *self)
static void
reset_save_timeout (EmpathyIrcNetworkManager *self)
{
- EmpathyIrcNetworkManagerPrivate *priv =
- EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ EmpathyIrcNetworkManagerPriv *priv = GET_PRIV (self);
if (priv->save_timer_id > 0)
{
@@ -283,8 +272,7 @@ static void
network_modified (EmpathyIrcNetwork *network,
EmpathyIrcNetworkManager *self)
{
- EmpathyIrcNetworkManagerPrivate *priv =
- EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ EmpathyIrcNetworkManagerPriv *priv = GET_PRIV (self);
network->user_defined = TRUE;
@@ -300,8 +288,7 @@ add_network (EmpathyIrcNetworkManager *self,
EmpathyIrcNetwork *network,
const gchar *id)
{
- EmpathyIrcNetworkManagerPrivate *priv =
- EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ EmpathyIrcNetworkManagerPriv *priv = GET_PRIV (self);
g_hash_table_insert (priv->networks, g_strdup (id), g_object_ref (network));
@@ -320,13 +307,13 @@ void
empathy_irc_network_manager_add (EmpathyIrcNetworkManager *self,
EmpathyIrcNetwork *network)
{
- EmpathyIrcNetworkManagerPrivate *priv;
+ EmpathyIrcNetworkManagerPriv *priv;
gchar *id = NULL;
g_return_if_fail (EMPATHY_IS_IRC_NETWORK_MANAGER (self));
g_return_if_fail (EMPATHY_IS_IRC_NETWORK (network));
- priv = EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ priv = GET_PRIV (self);
/* generate an id for this network */
do
@@ -365,12 +352,12 @@ void
empathy_irc_network_manager_remove (EmpathyIrcNetworkManager *self,
EmpathyIrcNetwork *network)
{
- EmpathyIrcNetworkManagerPrivate *priv;
+ EmpathyIrcNetworkManagerPriv *priv;
g_return_if_fail (EMPATHY_IS_IRC_NETWORK_MANAGER (self));
g_return_if_fail (EMPATHY_IS_IRC_NETWORK (network));
- priv = EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ priv = GET_PRIV (self);
network->user_defined = TRUE;
network->dropped = TRUE;
@@ -402,12 +389,12 @@ append_network_to_list (const gchar *id,
GSList *
empathy_irc_network_manager_get_networks (EmpathyIrcNetworkManager *self)
{
- EmpathyIrcNetworkManagerPrivate *priv;
+ EmpathyIrcNetworkManagerPriv *priv;
GSList *irc_networks = NULL;
g_return_val_if_fail (EMPATHY_IS_IRC_NETWORK_MANAGER (self), NULL);
- priv = EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ priv = GET_PRIV (self);
g_hash_table_foreach (priv->networks, (GHFunc) append_network_to_list,
&irc_networks);
@@ -422,8 +409,7 @@ empathy_irc_network_manager_get_networks (EmpathyIrcNetworkManager *self)
static void
load_global_file (EmpathyIrcNetworkManager *self)
{
- EmpathyIrcNetworkManagerPrivate *priv =
- EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ EmpathyIrcNetworkManagerPriv *priv = GET_PRIV (self);
if (priv->global_file == NULL)
return;
@@ -440,8 +426,7 @@ load_global_file (EmpathyIrcNetworkManager *self)
static void
load_user_file (EmpathyIrcNetworkManager *self)
{
- EmpathyIrcNetworkManagerPrivate *priv =
- EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ EmpathyIrcNetworkManagerPriv *priv = GET_PRIV (self);
if (priv->user_file == NULL)
return;
@@ -458,8 +443,7 @@ load_user_file (EmpathyIrcNetworkManager *self)
static void
irc_network_manager_load_servers (EmpathyIrcNetworkManager *self)
{
- EmpathyIrcNetworkManagerPrivate *priv =
- EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ EmpathyIrcNetworkManagerPriv *priv = GET_PRIV (self);
priv->loading = TRUE;
@@ -523,8 +507,7 @@ irc_network_manager_parse_irc_network (EmpathyIrcNetworkManager *self,
xmlNodePtr node,
gboolean user_defined)
{
- EmpathyIrcNetworkManagerPrivate *priv =
- EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ EmpathyIrcNetworkManagerPriv *priv = GET_PRIV (self);
EmpathyIrcNetwork *network;
xmlNodePtr child;
gchar *str;
@@ -594,13 +577,13 @@ irc_network_manager_file_parse (EmpathyIrcNetworkManager *self,
const gchar *filename,
gboolean user_defined)
{
- EmpathyIrcNetworkManagerPrivate *priv;
+ EmpathyIrcNetworkManagerPriv *priv;
xmlParserCtxtPtr ctxt;
xmlDocPtr doc;
xmlNodePtr networks;
xmlNodePtr node;
- priv = EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ priv = GET_PRIV (self);
DEBUG ("Attempting to parse file:'%s'...", filename);
@@ -707,8 +690,7 @@ write_network_to_xml (const gchar *id,
static gboolean
irc_network_manager_file_save (EmpathyIrcNetworkManager *self)
{
- EmpathyIrcNetworkManagerPrivate *priv =
- EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ EmpathyIrcNetworkManagerPriv *priv = GET_PRIV (self);
xmlDocPtr doc;
xmlNodePtr root;
@@ -785,8 +767,7 @@ empathy_irc_network_manager_find_network_by_address (
EmpathyIrcNetworkManager *self,
const gchar *address)
{
- EmpathyIrcNetworkManagerPrivate *priv =
- EMPATHY_IRC_NETWORK_MANAGER_GET_PRIVATE (self);
+ EmpathyIrcNetworkManagerPriv *priv = GET_PRIV (self);
EmpathyIrcNetwork *network;
g_return_val_if_fail (address != NULL, NULL);
diff --git a/libempathy/empathy-irc-network-manager.h b/libempathy/empathy-irc-network-manager.h
index a853a074b..1ec862e91 100644
--- a/libempathy/empathy-irc-network-manager.h
+++ b/libempathy/empathy-irc-network-manager.h
@@ -33,7 +33,6 @@ typedef struct _EmpathyIrcNetworkManagerClass EmpathyIrcNetworkManagerClass;
struct _EmpathyIrcNetworkManager
{
GObject parent;
-
gpointer priv;
};
diff --git a/libempathy/empathy-irc-network.c b/libempathy/empathy-irc-network.c
index f754adef6..17abd36e9 100644
--- a/libempathy/empathy-irc-network.c
+++ b/libempathy/empathy-irc-network.c
@@ -29,8 +29,15 @@
#include "empathy-marshal.h"
#include "empathy-irc-network.h"
+#include "empathy-utils.h"
-G_DEFINE_TYPE (EmpathyIrcNetwork, empathy_irc_network, G_TYPE_OBJECT);
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyIrcNetwork)
+typedef struct
+{
+ gchar *name;
+ gchar *charset;
+ GSList *servers;
+} EmpathyIrcNetworkPriv;
/* properties */
enum
@@ -49,17 +56,7 @@ enum
static guint signals[LAST_SIGNAL] = {0};
-typedef struct _EmpathyIrcNetworkPrivate EmpathyIrcNetworkPrivate;
-
-struct _EmpathyIrcNetworkPrivate
-{
- gchar *name;
- gchar *charset;
- GSList *servers;
-};
-
-#define EMPATHY_IRC_NETWORK_GET_PRIVATE(obj)\
- ((EmpathyIrcNetworkPrivate *) obj->priv)
+G_DEFINE_TYPE (EmpathyIrcNetwork, empathy_irc_network, G_TYPE_OBJECT);
static void
server_modified_cb (EmpathyIrcServer *server,
@@ -75,7 +72,7 @@ empathy_irc_network_get_property (GObject *object,
GParamSpec *pspec)
{
EmpathyIrcNetwork *self = EMPATHY_IRC_NETWORK (object);
- EmpathyIrcNetworkPrivate *priv = EMPATHY_IRC_NETWORK_GET_PRIVATE (self);
+ EmpathyIrcNetworkPriv *priv = GET_PRIV (self);
switch (property_id)
{
@@ -98,7 +95,7 @@ empathy_irc_network_set_property (GObject *object,
GParamSpec *pspec)
{
EmpathyIrcNetwork *self = EMPATHY_IRC_NETWORK (object);
- EmpathyIrcNetworkPrivate *priv = EMPATHY_IRC_NETWORK_GET_PRIVATE (self);
+ EmpathyIrcNetworkPriv *priv = GET_PRIV (self);
switch (property_id)
{
@@ -128,7 +125,7 @@ static void
empathy_irc_network_dispose (GObject *object)
{
EmpathyIrcNetwork *self = EMPATHY_IRC_NETWORK (object);
- EmpathyIrcNetworkPrivate *priv = EMPATHY_IRC_NETWORK_GET_PRIVATE (self);
+ EmpathyIrcNetworkPriv *priv = GET_PRIV (self);
GSList *l;
for (l = priv->servers; l != NULL; l = g_slist_next (l))
@@ -145,7 +142,7 @@ static void
empathy_irc_network_finalize (GObject *object)
{
EmpathyIrcNetwork *self = EMPATHY_IRC_NETWORK (object);
- EmpathyIrcNetworkPrivate *priv = EMPATHY_IRC_NETWORK_GET_PRIVATE (self);
+ EmpathyIrcNetworkPriv *priv = GET_PRIV (self);
g_slist_free (priv->servers);
g_free (priv->name);
@@ -157,8 +154,8 @@ empathy_irc_network_finalize (GObject *object)
static void
empathy_irc_network_init (EmpathyIrcNetwork *self)
{
- EmpathyIrcNetworkPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- EMPATHY_TYPE_IRC_NETWORK, EmpathyIrcNetworkPrivate);
+ EmpathyIrcNetworkPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ EMPATHY_TYPE_IRC_NETWORK, EmpathyIrcNetworkPriv);
self->priv = priv;
@@ -177,8 +174,7 @@ empathy_irc_network_class_init (EmpathyIrcNetworkClass *klass)
object_class->get_property = empathy_irc_network_get_property;
object_class->set_property = empathy_irc_network_set_property;
- g_type_class_add_private (object_class,
- sizeof (EmpathyIrcNetworkPrivate));
+ g_type_class_add_private (object_class, sizeof (EmpathyIrcNetworkPriv));
object_class->dispose = empathy_irc_network_dispose;
object_class->finalize = empathy_irc_network_finalize;
@@ -253,11 +249,11 @@ empathy_irc_network_new (const gchar *name)
GSList *
empathy_irc_network_get_servers (EmpathyIrcNetwork *self)
{
- EmpathyIrcNetworkPrivate *priv;
+ EmpathyIrcNetworkPriv *priv;
GSList *servers = NULL, *l;
g_return_val_if_fail (EMPATHY_IS_IRC_NETWORK (self), NULL);
- priv = EMPATHY_IRC_NETWORK_GET_PRIVATE (self);
+ priv = GET_PRIV (self);
for (l = priv->servers; l != NULL; l = g_slist_next (l))
{
@@ -280,12 +276,12 @@ void
empathy_irc_network_append_server (EmpathyIrcNetwork *self,
EmpathyIrcServer *server)
{
- EmpathyIrcNetworkPrivate *priv;
+ EmpathyIrcNetworkPriv *priv;
g_return_if_fail (EMPATHY_IS_IRC_NETWORK (self));
g_return_if_fail (server != NULL && EMPATHY_IS_IRC_SERVER (server));
- priv = EMPATHY_IRC_NETWORK_GET_PRIVATE (self);
+ priv = GET_PRIV (self);
g_return_if_fail (g_slist_find (priv->servers, server) == NULL);
@@ -309,13 +305,13 @@ void
empathy_irc_network_remove_server (EmpathyIrcNetwork *self,
EmpathyIrcServer *server)
{
- EmpathyIrcNetworkPrivate *priv;
+ EmpathyIrcNetworkPriv *priv;
GSList *l;
g_return_if_fail (EMPATHY_IS_IRC_NETWORK (self));
g_return_if_fail (server != NULL && EMPATHY_IS_IRC_SERVER (server));
- priv = EMPATHY_IRC_NETWORK_GET_PRIVATE (self);
+ priv = GET_PRIV (self);
l = g_slist_find (priv->servers, server);
if (l == NULL)
@@ -346,13 +342,13 @@ empathy_irc_network_set_server_position (EmpathyIrcNetwork *self,
EmpathyIrcServer *server,
gint pos)
{
- EmpathyIrcNetworkPrivate *priv;
+ EmpathyIrcNetworkPriv *priv;
GSList *l;
g_return_if_fail (EMPATHY_IS_IRC_NETWORK (self));
g_return_if_fail (server != NULL && EMPATHY_IS_IRC_SERVER (server));
- priv = EMPATHY_IRC_NETWORK_GET_PRIVATE (self);
+ priv = GET_PRIV (self);
l = g_slist_find (priv->servers, server);
if (l == NULL)
diff --git a/libempathy/empathy-irc-network.h b/libempathy/empathy-irc-network.h
index ac146a183..b10b2769e 100644
--- a/libempathy/empathy-irc-network.h
+++ b/libempathy/empathy-irc-network.h
@@ -32,12 +32,11 @@ typedef struct _EmpathyIrcNetworkClass EmpathyIrcNetworkClass;
struct _EmpathyIrcNetwork
{
- GObject parent;
+ GObject parent;
+ gpointer priv;
- gpointer priv;
-
- gboolean user_defined;
- gboolean dropped;
+ gboolean user_defined;
+ gboolean dropped;
};
struct _EmpathyIrcNetworkClass
diff --git a/libempathy/empathy-irc-server.c b/libempathy/empathy-irc-server.c
index 510acc77b..482214532 100644
--- a/libempathy/empathy-irc-server.c
+++ b/libempathy/empathy-irc-server.c
@@ -28,8 +28,15 @@
#include "empathy-marshal.h"
#include "empathy-irc-server.h"
+#include "empathy-utils.h"
-G_DEFINE_TYPE (EmpathyIrcServer, empathy_irc_server, G_TYPE_OBJECT);
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyIrcServer)
+typedef struct
+{
+ gchar *address;
+ gint port;
+ gboolean ssl;
+} EmpathyIrcServerPriv;
/* properties */
enum
@@ -49,17 +56,7 @@ enum
static guint signals[LAST_SIGNAL] = {0};
-typedef struct _EmpathyIrcServerPrivate EmpathyIrcServerPrivate;
-
-struct _EmpathyIrcServerPrivate
-{
- gchar *address;
- gint port;
- gboolean ssl;
-};
-
-#define EMPATHY_IRC_SERVER_GET_PRIVATE(obj)\
- ((EmpathyIrcServerPrivate *) obj->priv)
+G_DEFINE_TYPE (EmpathyIrcServer, empathy_irc_server, G_TYPE_OBJECT);
static void
empathy_irc_server_get_property (GObject *object,
@@ -68,7 +65,7 @@ empathy_irc_server_get_property (GObject *object,
GParamSpec *pspec)
{
EmpathyIrcServer *self = EMPATHY_IRC_SERVER (object);
- EmpathyIrcServerPrivate *priv = EMPATHY_IRC_SERVER_GET_PRIVATE (self);
+ EmpathyIrcServerPriv *priv = GET_PRIV (self);
switch (property_id)
{
@@ -94,7 +91,7 @@ empathy_irc_server_set_property (GObject *object,
GParamSpec *pspec)
{
EmpathyIrcServer *self = EMPATHY_IRC_SERVER (object);
- EmpathyIrcServerPrivate *priv = EMPATHY_IRC_SERVER_GET_PRIVATE (self);
+ EmpathyIrcServerPriv *priv = GET_PRIV (self);
switch (property_id)
{
@@ -130,7 +127,7 @@ static void
empathy_irc_server_finalize (GObject *object)
{
EmpathyIrcServer *self = EMPATHY_IRC_SERVER (object);
- EmpathyIrcServerPrivate *priv = EMPATHY_IRC_SERVER_GET_PRIVATE (self);
+ EmpathyIrcServerPriv *priv = GET_PRIV (self);
g_free (priv->address);
@@ -140,8 +137,8 @@ empathy_irc_server_finalize (GObject *object)
static void
empathy_irc_server_init (EmpathyIrcServer *self)
{
- EmpathyIrcServerPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- EMPATHY_TYPE_IRC_SERVER, EmpathyIrcServerPrivate);
+ EmpathyIrcServerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ EMPATHY_TYPE_IRC_SERVER, EmpathyIrcServerPriv);
self->priv = priv;
}
@@ -155,8 +152,7 @@ empathy_irc_server_class_init (EmpathyIrcServerClass *klass)
object_class->get_property = empathy_irc_server_get_property;
object_class->set_property = empathy_irc_server_set_property;
- g_type_class_add_private (object_class,
- sizeof (EmpathyIrcServerPrivate));
+ g_type_class_add_private (object_class, sizeof (EmpathyIrcServerPriv));
object_class->finalize = empathy_irc_server_finalize;
diff --git a/libempathy/empathy-irc-server.h b/libempathy/empathy-irc-server.h
index 09f8c1ef7..d72af64ac 100644
--- a/libempathy/empathy-irc-server.h
+++ b/libempathy/empathy-irc-server.h
@@ -30,9 +30,8 @@ typedef struct _EmpathyIrcServerClass EmpathyIrcServerClass;
struct _EmpathyIrcServer
{
- GObject parent;
-
- gpointer priv;
+ GObject parent;
+ gpointer priv;
};
struct _EmpathyIrcServerClass
diff --git a/libempathy/empathy-log-manager.c b/libempathy/empathy-log-manager.c
index 081807fe7..1115e43c3 100644
--- a/libempathy/empathy-log-manager.c
+++ b/libempathy/empathy-log-manager.c
@@ -36,9 +36,6 @@
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
#include "empathy-debug.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- EMPATHY_TYPE_LOG_MANAGER, EmpathyLogManagerPriv))
-
#define LOG_DIR_CREATE_MODE (S_IRUSR | S_IWUSR | S_IXUSR)
#define LOG_FILE_CREATE_MODE (S_IRUSR | S_IWUSR)
#define LOG_DIR_CHATROOMS "chatrooms"
@@ -53,12 +50,11 @@
#define LOG_FOOTER \
"</log>\n"
-struct _EmpathyLogManagerPriv {
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyLogManager)
+typedef struct {
gchar *basedir;
-};
+} EmpathyLogManagerPriv;
-static void empathy_log_manager_class_init (EmpathyLogManagerClass *klass);
-static void empathy_log_manager_init (EmpathyLogManager *manager);
static void log_manager_finalize (GObject *object);
static const gchar * log_manager_get_basedir (EmpathyLogManager *manager);
static GList * log_manager_get_all_files (EmpathyLogManager *manager,
@@ -100,6 +96,10 @@ empathy_log_manager_class_init (EmpathyLogManagerClass *klass)
static void
empathy_log_manager_init (EmpathyLogManager *manager)
{
+ EmpathyLogManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
+ EMPATHY_TYPE_LOG_MANAGER, EmpathyLogManagerPriv);
+
+ manager->priv = priv;
}
static void
@@ -146,7 +146,7 @@ empathy_log_manager_add_message (EmpathyLogManager *manager,
gchar *timestamp;
gchar *contact_name;
gchar *contact_id;
- EmpathyMessageType msg_type;
+ TpChannelTextMessageType msg_type;
g_return_if_fail (EMPATHY_IS_LOG_MANAGER (manager));
g_return_if_fail (chat_id != NULL);
@@ -155,7 +155,7 @@ empathy_log_manager_add_message (EmpathyLogManager *manager,
sender = empathy_message_get_sender (message);
account = empathy_contact_get_account (sender);
body_str = empathy_message_get_body (message);
- msg_type = empathy_message_get_type (message);
+ msg_type = empathy_message_get_tptype (message);
if (G_STR_EMPTY (body_str)) {
return;
@@ -347,7 +347,7 @@ empathy_log_manager_get_messages_for_file (EmpathyLogManager *manager,
gchar *is_user_str;
gboolean is_user = FALSE;
gchar *msg_type_str;
- EmpathyMessageType msg_type = EMPATHY_MESSAGE_TYPE_NORMAL;
+ TpChannelTextMessageType msg_type = TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL;
if (strcmp (node->name, "message") != 0) {
continue;
@@ -383,7 +383,7 @@ empathy_log_manager_get_messages_for_file (EmpathyLogManager *manager,
message = empathy_message_new (body);
empathy_message_set_sender (message, sender);
empathy_message_set_timestamp (message, t);
- empathy_message_set_type (message, msg_type);
+ empathy_message_set_tptype (message, msg_type);
messages = g_list_append (messages, message);
diff --git a/libempathy/empathy-log-manager.h b/libempathy/empathy-log-manager.h
index 606f38c6c..4aec816c6 100644
--- a/libempathy/empathy-log-manager.h
+++ b/libempathy/empathy-log-manager.h
@@ -41,11 +41,11 @@ G_BEGIN_DECLS
typedef struct _EmpathyLogManager EmpathyLogManager;
typedef struct _EmpathyLogManagerClass EmpathyLogManagerClass;
-typedef struct _EmpathyLogManagerPriv EmpathyLogManagerPriv;
typedef struct _EmpathyLogSearchHit EmpathyLogSearchHit;
struct _EmpathyLogManager {
GObject parent;
+ gpointer priv;
};
struct _EmpathyLogManagerClass {
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c
index bac90c76e..6636fe69d 100644
--- a/libempathy/empathy-message.c
+++ b/libempathy/empathy-message.c
@@ -29,20 +29,15 @@
#include "empathy-message.h"
#include "empathy-enum-types.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_MESSAGE, EmpathyMessagePriv))
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyMessage)
+typedef struct {
+ TpChannelTextMessageType type;
+ EmpathyContact *sender;
+ EmpathyContact *receiver;
+ gchar *body;
+ time_t timestamp;
+} EmpathyMessagePriv;
-typedef struct _EmpathyMessagePriv EmpathyMessagePriv;
-
-struct _EmpathyMessagePriv {
- EmpathyMessageType type;
- EmpathyContact *sender;
- EmpathyContact *receiver;
- gchar *body;
- time_t timestamp;
-};
-
-static void empathy_message_class_init (EmpathyMessageClass *class);
-static void empathy_message_init (EmpathyMessage *message);
static void empathy_message_finalize (GObject *object);
static void message_get_property (GObject *object,
guint param_id,
@@ -53,6 +48,8 @@ static void message_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec);
+G_DEFINE_TYPE (EmpathyMessage, empathy_message, G_TYPE_OBJECT);
+
enum {
PROP_0,
PROP_TYPE,
@@ -62,53 +59,24 @@ enum {
PROP_TIMESTAMP,
};
-static gpointer parent_class = NULL;
-
-GType
-empathy_message_get_gtype (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EmpathyMessageClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) empathy_message_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EmpathyMessage),
- 0, /* n_preallocs */
- (GInstanceInitFunc) empathy_message_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EmpathyMessage",
- &info, 0);
- }
-
- return type;
-}
-
static void
empathy_message_class_init (EmpathyMessageClass *class)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (class);
- parent_class = g_type_class_peek_parent (class);
-
object_class->finalize = empathy_message_finalize;
object_class->get_property = message_get_property;
object_class->set_property = message_set_property;
g_object_class_install_property (object_class,
PROP_TYPE,
- g_param_spec_enum ("type",
+ g_param_spec_uint ("type",
"Message Type",
"The type of message",
- EMPATHY_TYPE_MESSAGE_TYPE,
- EMPATHY_MESSAGE_TYPE_NORMAL,
+ TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL,
+ TP_CHANNEL_TEXT_MESSAGE_TYPE_AUTO_REPLY,
+ TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_SENDER,
@@ -149,10 +117,10 @@ empathy_message_class_init (EmpathyMessageClass *class)
static void
empathy_message_init (EmpathyMessage *message)
{
- EmpathyMessagePriv *priv;
-
- priv = GET_PRIV (message);
+ EmpathyMessagePriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (message,
+ EMPATHY_TYPE_MESSAGE, EmpathyMessagePriv);
+ message->priv = priv;
priv->timestamp = empathy_time_get_current ();
}
@@ -172,7 +140,7 @@ empathy_message_finalize (GObject *object)
g_free (priv->body);
- (G_OBJECT_CLASS (parent_class)->finalize) (object);
+ G_OBJECT_CLASS (empathy_message_parent_class)->finalize (object);
}
static void
@@ -187,7 +155,7 @@ message_get_property (GObject *object,
switch (param_id) {
case PROP_TYPE:
- g_value_set_enum (value, priv->type);
+ g_value_set_uint (value, priv->type);
break;
case PROP_SENDER:
g_value_set_object (value, priv->sender);
@@ -216,8 +184,8 @@ message_set_property (GObject *object,
switch (param_id) {
case PROP_TYPE:
- empathy_message_set_type (EMPATHY_MESSAGE (object),
- g_value_get_enum (value));
+ empathy_message_set_tptype (EMPATHY_MESSAGE (object),
+ g_value_get_uint (value));
break;
case PROP_SENDER:
empathy_message_set_sender (EMPATHY_MESSAGE (object),
@@ -245,13 +213,13 @@ empathy_message_new (const gchar *body)
NULL);
}
-EmpathyMessageType
-empathy_message_get_type (EmpathyMessage *message)
+TpChannelTextMessageType
+empathy_message_get_tptype (EmpathyMessage *message)
{
EmpathyMessagePriv *priv;
g_return_val_if_fail (EMPATHY_IS_MESSAGE (message),
- EMPATHY_MESSAGE_TYPE_NORMAL);
+ TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL);
priv = GET_PRIV (message);
@@ -259,8 +227,8 @@ empathy_message_get_type (EmpathyMessage *message)
}
void
-empathy_message_set_type (EmpathyMessage *message,
- EmpathyMessageType type)
+empathy_message_set_tptype (EmpathyMessage *message,
+ TpChannelTextMessageType type)
{
EmpathyMessagePriv *priv;
@@ -353,21 +321,19 @@ empathy_message_get_body (EmpathyMessage *message)
void
empathy_message_set_body (EmpathyMessage *message,
- const gchar *body)
+ const gchar *body)
{
- EmpathyMessagePriv *priv;
- EmpathyMessageType type;
+ EmpathyMessagePriv *priv = GET_PRIV (message);
+ TpChannelTextMessageType type;
g_return_if_fail (EMPATHY_IS_MESSAGE (message));
- priv = GET_PRIV (message);
-
g_free (priv->body);
priv->body = NULL;
- type = EMPATHY_MESSAGE_TYPE_NORMAL;
+ type = TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL;
if (g_str_has_prefix (body, "/me")) {
- type = EMPATHY_MESSAGE_TYPE_ACTION;
+ type = TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION;
body += 4;
}
else if (g_str_has_prefix (body, "/say")) {
@@ -379,7 +345,7 @@ empathy_message_set_body (EmpathyMessage *message,
}
if (type != priv->type) {
- empathy_message_set_type (message, type);
+ empathy_message_set_tptype (message, type);
}
g_object_notify (G_OBJECT (message), "body");
@@ -498,34 +464,34 @@ finished:
return ret_val;
}
-EmpathyMessageType
+TpChannelTextMessageType
empathy_message_type_from_str (const gchar *type_str)
{
if (strcmp (type_str, "normal") == 0) {
- return EMPATHY_MESSAGE_TYPE_NORMAL;
+ return TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL;
}
if (strcmp (type_str, "action") == 0) {
- return EMPATHY_MESSAGE_TYPE_ACTION;
+ return TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION;
}
else if (strcmp (type_str, "notice") == 0) {
- return EMPATHY_MESSAGE_TYPE_NOTICE;
+ return TP_CHANNEL_TEXT_MESSAGE_TYPE_NOTICE;
}
else if (strcmp (type_str, "auto-reply") == 0) {
- return EMPATHY_MESSAGE_TYPE_AUTO_REPLY;
+ return TP_CHANNEL_TEXT_MESSAGE_TYPE_AUTO_REPLY;
}
- return EMPATHY_MESSAGE_TYPE_NORMAL;
+ return TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL;
}
const gchar *
-empathy_message_type_to_str (EmpathyMessageType type)
+empathy_message_type_to_str (TpChannelTextMessageType type)
{
switch (type) {
- case EMPATHY_MESSAGE_TYPE_ACTION:
+ case TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION:
return "action";
- case EMPATHY_MESSAGE_TYPE_NOTICE:
+ case TP_CHANNEL_TEXT_MESSAGE_TYPE_NOTICE:
return "notice";
- case EMPATHY_MESSAGE_TYPE_AUTO_REPLY:
+ case TP_CHANNEL_TEXT_MESSAGE_TYPE_AUTO_REPLY:
return "auto-reply";
default:
return "normal";
diff --git a/libempathy/empathy-message.h b/libempathy/empathy-message.h
index 6cf7d881c..fd3e0735c 100644
--- a/libempathy/empathy-message.h
+++ b/libempathy/empathy-message.h
@@ -32,7 +32,7 @@
G_BEGIN_DECLS
-#define EMPATHY_TYPE_MESSAGE (empathy_message_get_gtype ())
+#define EMPATHY_TYPE_MESSAGE (empathy_message_get_type ())
#define EMPATHY_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_MESSAGE, EmpathyMessage))
#define EMPATHY_MESSAGE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_MESSAGE, EmpathyMessageClass))
#define EMPATHY_IS_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_MESSAGE))
@@ -44,42 +44,35 @@ typedef struct _EmpathyMessageClass EmpathyMessageClass;
struct _EmpathyMessage {
GObject parent;
+ gpointer priv;
};
struct _EmpathyMessageClass {
GObjectClass parent_class;
};
-typedef enum {
- EMPATHY_MESSAGE_TYPE_NORMAL,
- EMPATHY_MESSAGE_TYPE_ACTION,
- EMPATHY_MESSAGE_TYPE_NOTICE,
- EMPATHY_MESSAGE_TYPE_AUTO_REPLY,
- EMPATHY_MESSAGE_TYPE_LAST
-} EmpathyMessageType;
-
-GType empathy_message_get_gtype (void) G_GNUC_CONST;
-EmpathyMessage * empathy_message_new (const gchar *body);
-EmpathyMessageType empathy_message_get_type (EmpathyMessage *message);
-void empathy_message_set_type (EmpathyMessage *message,
- EmpathyMessageType type);
-EmpathyContact * empathy_message_get_sender (EmpathyMessage *message);
-void empathy_message_set_sender (EmpathyMessage *message,
- EmpathyContact *contact);
-EmpathyContact * empathy_message_get_receiver (EmpathyMessage *message);
-void empathy_message_set_receiver (EmpathyMessage *message,
- EmpathyContact *contact);
-const gchar * empathy_message_get_body (EmpathyMessage *message);
-void empathy_message_set_body (EmpathyMessage *message,
- const gchar *body);
-time_t empathy_message_get_timestamp (EmpathyMessage *message);
-void empathy_message_set_timestamp (EmpathyMessage *message,
- time_t timestamp);
-GDate * empathy_message_get_date_and_time (EmpathyMessage *message,
- time_t *timestamp);
-gboolean empathy_message_should_highlight (EmpathyMessage *message);
-EmpathyMessageType empathy_message_type_from_str (const gchar *type_str);
-const gchar * empathy_message_type_to_str (EmpathyMessageType type);
+GType empathy_message_get_type (void) G_GNUC_CONST;
+EmpathyMessage * empathy_message_new (const gchar *body);
+TpChannelTextMessageType empathy_message_get_tptype (EmpathyMessage *message);
+void empathy_message_set_tptype (EmpathyMessage *message,
+ TpChannelTextMessageType type);
+EmpathyContact * empathy_message_get_sender (EmpathyMessage *message);
+void empathy_message_set_sender (EmpathyMessage *message,
+ EmpathyContact *contact);
+EmpathyContact * empathy_message_get_receiver (EmpathyMessage *message);
+void empathy_message_set_receiver (EmpathyMessage *message,
+ EmpathyContact *contact);
+const gchar * empathy_message_get_body (EmpathyMessage *message);
+void empathy_message_set_body (EmpathyMessage *message,
+ const gchar *body);
+time_t empathy_message_get_timestamp (EmpathyMessage *message);
+void empathy_message_set_timestamp (EmpathyMessage *message,
+ time_t timestamp);
+GDate * empathy_message_get_date_and_time (EmpathyMessage *message,
+ time_t *timestamp);
+gboolean empathy_message_should_highlight (EmpathyMessage *message);
+TpChannelTextMessageType empathy_message_type_from_str (const gchar *type_str);
+const gchar * empathy_message_type_to_str (TpChannelTextMessageType type);
G_END_DECLS
diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-call.c
index 8e1ba52b9..03dff8033 100644
--- a/libempathy/empathy-tp-call.c
+++ b/libempathy/empathy-tp-call.c
@@ -27,24 +27,20 @@
#include <telepathy-glib/dbus.h>
#include <extensions/extensions.h>
-#include <libempathy/empathy-contact-factory.h>
-#include <libempathy/empathy-tp-group.h>
-#include <libempathy/empathy-utils.h>
#include "empathy-tp-call.h"
+#include "empathy-contact-factory.h"
+#include "empathy-tp-group.h"
+#include "empathy-utils.h"
#define DEBUG_FLAG EMPATHY_DEBUG_TP
#include "empathy-debug.h"
-#define GET_PRIV(object) (G_TYPE_INSTANCE_GET_PRIVATE \
- ((object), EMPATHY_TYPE_TP_CALL, EmpathyTpCallPriv))
-
#define STREAM_ENGINE_BUS_NAME "org.freedesktop.Telepathy.StreamEngine"
#define STREAM_ENGINE_OBJECT_PATH "/org/freedesktop/Telepathy/StreamEngine"
-typedef struct _EmpathyTpCallPriv EmpathyTpCallPriv;
-
-struct _EmpathyTpCallPriv
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpCall)
+typedef struct
{
TpChannel *channel;
TpProxy *stream_engine;
@@ -57,7 +53,7 @@ struct _EmpathyTpCallPriv
EmpathyTpCallStream *audio;
EmpathyTpCallStream *video;
-};
+} EmpathyTpCallPriv;
enum
{
@@ -629,8 +625,10 @@ empathy_tp_call_class_init (EmpathyTpCallClass *klass)
static void
empathy_tp_call_init (EmpathyTpCall *call)
{
- EmpathyTpCallPriv *priv = GET_PRIV (call);
+ EmpathyTpCallPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (call,
+ EMPATHY_TYPE_TP_CALL, EmpathyTpCallPriv);
+ call->priv = priv;
priv->status = EMPATHY_TP_CALL_STATUS_READYING;
priv->contact = NULL;
priv->stream_engine_running = FALSE;
diff --git a/libempathy/empathy-tp-call.h b/libempathy/empathy-tp-call.h
index 18378baa3..644d778fb 100644
--- a/libempathy/empathy-tp-call.h
+++ b/libempathy/empathy-tp-call.h
@@ -45,11 +45,12 @@ typedef struct _EmpathyTpCall EmpathyTpCall;
typedef struct _EmpathyTpCallClass EmpathyTpCallClass;
struct _EmpathyTpCall {
- GObject parent;
+ GObject parent;
+ gpointer priv;
};
struct _EmpathyTpCallClass {
- GObjectClass parent_class;
+ GObjectClass parent_class;
};
typedef enum
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 61859c96e..d4eedf492 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -37,10 +37,8 @@
#define DEBUG_FLAG EMPATHY_DEBUG_TP | EMPATHY_DEBUG_CHAT
#include "empathy-debug.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- EMPATHY_TYPE_TP_CHAT, EmpathyTpChatPriv))
-
-struct _EmpathyTpChatPriv {
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpChat)
+typedef struct {
EmpathyContactFactory *factory;
EmpathyContact *user;
EmpathyContact *remote_contact;
@@ -55,7 +53,7 @@ struct _EmpathyTpChatPriv {
GPtrArray *properties;
gboolean ready;
guint members_count;
-};
+} EmpathyTpChatPriv;
typedef struct {
gchar *name;
@@ -64,8 +62,6 @@ typedef struct {
GValue *value;
} TpChatProperty;
-static void empathy_tp_chat_class_init (EmpathyTpChatClass *klass);
-static void empathy_tp_chat_init (EmpathyTpChat *chat);
static void tp_chat_iface_init (EmpathyContactListIface *iface);
enum {
@@ -274,7 +270,7 @@ tp_chat_build_message (EmpathyTpChat *chat,
}
message = empathy_message_new (message_body);
- empathy_message_set_type (message, type);
+ empathy_message_set_tptype (message, type);
empathy_message_set_sender (message, sender);
empathy_message_set_receiver (message, priv->user);
empathy_message_set_timestamp (message, timestamp);
@@ -1060,6 +1056,10 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass)
static void
empathy_tp_chat_init (EmpathyTpChat *chat)
{
+ EmpathyTpChatPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (chat,
+ EMPATHY_TYPE_TP_CHAT, EmpathyTpChatPriv);
+
+ chat->priv = priv;
}
static void
@@ -1172,16 +1172,16 @@ void
empathy_tp_chat_send (EmpathyTpChat *chat,
EmpathyMessage *message)
{
- EmpathyTpChatPriv *priv = GET_PRIV (chat);
- const gchar *message_body;
- EmpathyMessageType message_type;
+ EmpathyTpChatPriv *priv = GET_PRIV (chat);
+ const gchar *message_body;
+ TpChannelTextMessageType message_type;
g_return_if_fail (EMPATHY_IS_TP_CHAT (chat));
g_return_if_fail (EMPATHY_IS_MESSAGE (message));
g_return_if_fail (priv->ready);
message_body = empathy_message_get_body (message);
- message_type = empathy_message_get_type (message);
+ message_type = empathy_message_get_tptype (message);
DEBUG ("Sending message: %s", message_body);
tp_cli_channel_type_text_call_send (priv->channel, -1,
diff --git a/libempathy/empathy-tp-chat.h b/libempathy/empathy-tp-chat.h
index 12cd5cf92..0d5b4f94d 100644
--- a/libempathy/empathy-tp-chat.h
+++ b/libempathy/empathy-tp-chat.h
@@ -42,10 +42,10 @@ G_BEGIN_DECLS
typedef struct _EmpathyTpChat EmpathyTpChat;
typedef struct _EmpathyTpChatClass EmpathyTpChatClass;
-typedef struct _EmpathyTpChatPriv EmpathyTpChatPriv;
struct _EmpathyTpChat {
- GObject parent;
+ GObject parent;
+ gpointer priv;
};
struct _EmpathyTpChatClass {
diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c
index e071ff5fb..7cf0b53cc 100644
--- a/libempathy/empathy-tp-contact-factory.c
+++ b/libempathy/empathy-tp-contact-factory.c
@@ -33,10 +33,8 @@
#define DEBUG_FLAG EMPATHY_DEBUG_TP | EMPATHY_DEBUG_CONTACT
#include "empathy-debug.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- EMPATHY_TYPE_TP_CONTACT_FACTORY, EmpathyTpContactFactoryPriv))
-
-struct _EmpathyTpContactFactoryPriv {
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpContactFactory)
+typedef struct {
MissionControl *mc;
McAccount *account;
TpConnection *connection;
@@ -45,10 +43,7 @@ struct _EmpathyTpContactFactoryPriv {
GList *contacts;
EmpathyContact *user;
gpointer token;
-};
-
-static void empathy_tp_contact_factory_class_init (EmpathyTpContactFactoryClass *klass);
-static void empathy_tp_contact_factory_init (EmpathyTpContactFactory *factory);
+} EmpathyTpContactFactoryPriv;
G_DEFINE_TYPE (EmpathyTpContactFactory, empathy_tp_contact_factory, G_TYPE_OBJECT);
@@ -1276,8 +1271,10 @@ empathy_tp_contact_factory_class_init (EmpathyTpContactFactoryClass *klass)
static void
empathy_tp_contact_factory_init (EmpathyTpContactFactory *tp_factory)
{
- EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
+ EmpathyTpContactFactoryPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (tp_factory,
+ EMPATHY_TYPE_TP_CONTACT_FACTORY, EmpathyTpContactFactoryPriv);
+ tp_factory->priv = priv;
priv->mc = empathy_mission_control_new ();
priv->token = empathy_connect_to_account_status_changed (priv->mc,
G_CALLBACK (tp_contact_factory_status_changed_cb),
diff --git a/libempathy/empathy-tp-contact-factory.h b/libempathy/empathy-tp-contact-factory.h
index f1e71c8fa..92e7c2980 100644
--- a/libempathy/empathy-tp-contact-factory.h
+++ b/libempathy/empathy-tp-contact-factory.h
@@ -39,10 +39,10 @@ G_BEGIN_DECLS
typedef struct _EmpathyTpContactFactory EmpathyTpContactFactory;
typedef struct _EmpathyTpContactFactoryClass EmpathyTpContactFactoryClass;
-typedef struct _EmpathyTpContactFactoryPriv EmpathyTpContactFactoryPriv;
struct _EmpathyTpContactFactory {
GObject parent;
+ gpointer priv;
};
struct _EmpathyTpContactFactoryClass {
diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c
index b40042513..9fb5c0402 100644
--- a/libempathy/empathy-tp-contact-list.c
+++ b/libempathy/empathy-tp-contact-list.c
@@ -38,10 +38,8 @@
#define DEBUG_FLAG EMPATHY_DEBUG_TP | EMPATHY_DEBUG_CONTACT
#include "empathy-debug.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- EMPATHY_TYPE_TP_CONTACT_LIST, EmpathyTpContactListPriv))
-
-struct _EmpathyTpContactListPriv {
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpContactList)
+typedef struct {
McAccount *account;
TpConnection *connection;
const gchar *protocol_group;
@@ -54,7 +52,7 @@ struct _EmpathyTpContactListPriv {
GList *groups;
GHashTable *contacts_groups;
-};
+} EmpathyTpContactListPriv;
typedef enum {
TP_CONTACT_LIST_TYPE_PUBLISH,
@@ -62,8 +60,6 @@ typedef enum {
TP_CONTACT_LIST_TYPE_UNKNOWN
} TpContactListType;
-static void empathy_tp_contact_list_class_init (EmpathyTpContactListClass *klass);
-static void empathy_tp_contact_list_init (EmpathyTpContactList *list);
static void tp_contact_list_iface_init (EmpathyContactListIface *iface);
enum {
@@ -742,8 +738,10 @@ empathy_tp_contact_list_class_init (EmpathyTpContactListClass *klass)
static void
empathy_tp_contact_list_init (EmpathyTpContactList *list)
{
- EmpathyTpContactListPriv *priv = GET_PRIV (list);
+ EmpathyTpContactListPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (list,
+ EMPATHY_TYPE_TP_CONTACT_LIST, EmpathyTpContactListPriv);
+ list->priv = priv;
priv->contacts_groups = g_hash_table_new_full (g_direct_hash,
g_direct_equal,
(GDestroyNotify) g_object_unref,
diff --git a/libempathy/empathy-tp-contact-list.h b/libempathy/empathy-tp-contact-list.h
index f282d65ee..863711e18 100644
--- a/libempathy/empathy-tp-contact-list.h
+++ b/libempathy/empathy-tp-contact-list.h
@@ -38,10 +38,10 @@ G_BEGIN_DECLS
typedef struct _EmpathyTpContactList EmpathyTpContactList;
typedef struct _EmpathyTpContactListClass EmpathyTpContactListClass;
-typedef struct _EmpathyTpContactListPriv EmpathyTpContactListPriv;
struct _EmpathyTpContactList {
- GObject parent;
+ GObject parent;
+ gpointer priv;
};
struct _EmpathyTpContactListClass {
diff --git a/libempathy/empathy-tp-group.c b/libempathy/empathy-tp-group.c
index 776fb78a8..29a786dc0 100644
--- a/libempathy/empathy-tp-group.c
+++ b/libempathy/empathy-tp-group.c
@@ -36,10 +36,8 @@
#define DEBUG_FLAG EMPATHY_DEBUG_TP
#include "empathy-debug.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- EMPATHY_TYPE_TP_GROUP, EmpathyTpGroupPriv))
-
-struct _EmpathyTpGroupPriv {
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpGroup)
+typedef struct {
TpChannel *channel;
gboolean ready;
@@ -50,10 +48,7 @@ struct _EmpathyTpGroupPriv {
GList *members;
GList *local_pendings;
GList *remote_pendings;
-};
-
-static void empathy_tp_group_class_init (EmpathyTpGroupClass *klass);
-static void empathy_tp_group_init (EmpathyTpGroup *group);
+} EmpathyTpGroupPriv;
enum {
MEMBER_ADDED,
@@ -714,6 +709,10 @@ empathy_tp_group_class_init (EmpathyTpGroupClass *klass)
static void
empathy_tp_group_init (EmpathyTpGroup *group)
{
+ EmpathyTpGroupPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (group,
+ EMPATHY_TYPE_TP_GROUP, EmpathyTpGroupPriv);
+
+ group->priv = priv;
}
EmpathyTpGroup *
diff --git a/libempathy/empathy-tp-group.h b/libempathy/empathy-tp-group.h
index df5c54980..bbd4b84f9 100644
--- a/libempathy/empathy-tp-group.h
+++ b/libempathy/empathy-tp-group.h
@@ -40,10 +40,10 @@ G_BEGIN_DECLS
typedef struct _EmpathyTpGroup EmpathyTpGroup;
typedef struct _EmpathyTpGroupClass EmpathyTpGroupClass;
-typedef struct _EmpathyTpGroupPriv EmpathyTpGroupPriv;
struct _EmpathyTpGroup {
- GObject parent;
+ GObject parent;
+ gpointer priv;
};
struct _EmpathyTpGroupClass {
diff --git a/libempathy/empathy-tp-roomlist.c b/libempathy/empathy-tp-roomlist.c
index c88580a93..c631e6ab4 100644
--- a/libempathy/empathy-tp-roomlist.c
+++ b/libempathy/empathy-tp-roomlist.c
@@ -36,18 +36,13 @@
#define DEBUG_FLAG EMPATHY_DEBUG_TP
#include "empathy-debug.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- EMPATHY_TYPE_TP_ROOMLIST, EmpathyTpRoomlistPriv))
-
-struct _EmpathyTpRoomlistPriv {
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpRoomlist)
+typedef struct {
TpConnection *connection;
TpChannel *channel;
McAccount *account;
gboolean is_listing;
-};
-
-static void empathy_tp_roomlist_class_init (EmpathyTpRoomlistClass *klass);
-static void empathy_tp_roomlist_init (EmpathyTpRoomlist *chat);
+} EmpathyTpRoomlistPriv;
enum {
NEW_ROOM,
@@ -338,6 +333,10 @@ empathy_tp_roomlist_class_init (EmpathyTpRoomlistClass *klass)
static void
empathy_tp_roomlist_init (EmpathyTpRoomlist *list)
{
+ EmpathyTpRoomlistPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (list,
+ EMPATHY_TYPE_TP_ROOMLIST, EmpathyTpRoomlistPriv);
+
+ list->priv = priv;
}
EmpathyTpRoomlist *
diff --git a/libempathy/empathy-tp-roomlist.h b/libempathy/empathy-tp-roomlist.h
index d03fede38..9f45b7f5c 100644
--- a/libempathy/empathy-tp-roomlist.h
+++ b/libempathy/empathy-tp-roomlist.h
@@ -38,10 +38,10 @@ G_BEGIN_DECLS
typedef struct _EmpathyTpRoomlist EmpathyTpRoomlist;
typedef struct _EmpathyTpRoomlistClass EmpathyTpRoomlistClass;
-typedef struct _EmpathyTpRoomlistPriv EmpathyTpRoomlistPriv;
struct _EmpathyTpRoomlist {
- GObject parent;
+ GObject parent;
+ gpointer priv;
};
struct _EmpathyTpRoomlistClass {
diff --git a/libempathy/empathy-tp-tube.c b/libempathy/empathy-tp-tube.c
index b1e6676ff..796ccbe34 100644
--- a/libempathy/empathy-tp-tube.c
+++ b/libempathy/empathy-tp-tube.c
@@ -32,12 +32,8 @@
#define DEBUG_FLAG EMPATHY_DEBUG_TP
#include "empathy-debug.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_TP_TUBE, \
- EmpathyTpTubePriv))
-
-typedef struct _EmpathyTpTubePriv EmpathyTpTubePriv;
-
-struct _EmpathyTpTubePriv
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpTube)
+typedef struct
{
TpChannel *channel;
guint id;
@@ -48,7 +44,7 @@ struct _EmpathyTpTubePriv
guint state;
EmpathyContact *initiator_contact;
EmpathyContactFactory *factory;
-};
+} EmpathyTpTubePriv;
enum
{
@@ -350,7 +346,10 @@ empathy_tp_tube_class_init (EmpathyTpTubeClass *klass)
static void
empathy_tp_tube_init (EmpathyTpTube *tube)
{
- EmpathyTpTubePriv *priv = GET_PRIV (tube);
+ EmpathyTpTubePriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (tube,
+ EMPATHY_TYPE_TP_TUBE, EmpathyTpTubePriv);
+
+ tube->priv = priv;
priv->factory = empathy_contact_factory_new ();
}
diff --git a/libempathy/empathy-tp-tube.h b/libempathy/empathy-tp-tube.h
index 103c92b9d..d439c6b63 100644
--- a/libempathy/empathy-tp-tube.h
+++ b/libempathy/empathy-tp-tube.h
@@ -47,6 +47,7 @@ typedef struct _EmpathyTpTubeClass EmpathyTpTubeClass;
struct _EmpathyTpTube {
GObject parent;
+ gpointer priv;
};
struct _EmpathyTpTubeClass {
diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h
index 6aab7cf00..800f09d05 100644
--- a/libempathy/empathy-utils.h
+++ b/libempathy/empathy-utils.h
@@ -39,6 +39,7 @@
G_BEGIN_DECLS
+#define EMPATHY_GET_PRIV(obj,type) ((type##Priv*) ((type*)obj)->priv)
#define G_STR_EMPTY(x) ((x) == NULL || (x)[0] == '\0')
typedef enum {