From 1557095113a3c0f5baadcfb1e953d73762e5263e Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 5 May 2008 20:34:41 +0000 Subject: Keep a priv pointer in the object struct instead of using G_TYPE_INSTANCE_GET_PRIVATE all the time. svn path=/trunk/; revision=1082 --- libempathy-gtk/empathy-account-chooser.c | 7 +- libempathy-gtk/empathy-account-chooser.h | 1 + libempathy-gtk/empathy-avatar-chooser.c | 10 +- libempathy-gtk/empathy-avatar-chooser.h | 2 +- libempathy-gtk/empathy-avatar-image.c | 10 +- libempathy-gtk/empathy-avatar-image.h | 1 + libempathy-gtk/empathy-cell-renderer-expander.c | 54 +++++------ libempathy-gtk/empathy-cell-renderer-expander.h | 1 + libempathy-gtk/empathy-cell-renderer-text.c | 16 ++-- libempathy-gtk/empathy-cell-renderer-text.h | 6 +- libempathy-gtk/empathy-chat-view.c | 17 ++-- libempathy-gtk/empathy-chat-view.h | 2 +- libempathy-gtk/empathy-chat.c | 14 ++- libempathy-gtk/empathy-chat.h | 2 +- libempathy-gtk/empathy-conf.c | 10 +- libempathy-gtk/empathy-conf.h | 1 + libempathy-gtk/empathy-contact-list-store.c | 12 +-- libempathy-gtk/empathy-contact-list-store.h | 1 + libempathy-gtk/empathy-contact-list-view.c | 7 +- libempathy-gtk/empathy-contact-list-view.h | 5 +- libempathy-gtk/empathy-presence-chooser.c | 15 ++- libempathy-gtk/empathy-presence-chooser.h | 1 + libempathy-gtk/empathy-smiley-manager.c | 22 ++--- libempathy-gtk/empathy-smiley-manager.h | 2 +- libempathy-gtk/empathy-theme-boxes.c | 17 ++-- libempathy-gtk/empathy-theme-boxes.h | 1 + libempathy-gtk/empathy-theme-irc.c | 19 ++-- libempathy-gtk/empathy-theme-irc.h | 1 + libempathy-gtk/empathy-theme-manager.c | 9 +- libempathy-gtk/empathy-theme-manager.h | 3 +- libempathy-gtk/empathy-theme.c | 17 ++-- libempathy-gtk/empathy-theme.h | 1 + libempathy/empathy-chatroom-manager.c | 14 ++- libempathy/empathy-chatroom-manager.h | 2 +- libempathy/empathy-chatroom.c | 14 +-- libempathy/empathy-chatroom.h | 2 +- libempathy/empathy-contact-factory.c | 15 ++- libempathy/empathy-contact-factory.h | 2 +- libempathy/empathy-contact-manager.c | 16 ++-- libempathy/empathy-contact-manager.h | 4 +- libempathy/empathy-contact.c | 15 ++- libempathy/empathy-contact.h | 1 + libempathy/empathy-idle.c | 32 +++---- libempathy/empathy-idle.h | 2 +- libempathy/empathy-irc-network-manager.c | 91 ++++++++---------- libempathy/empathy-irc-network-manager.h | 1 - libempathy/empathy-irc-network.c | 52 +++++------ libempathy/empathy-irc-network.h | 9 +- libempathy/empathy-irc-server.c | 34 +++---- libempathy/empathy-irc-server.h | 5 +- libempathy/empathy-log-manager.c | 22 ++--- libempathy/empathy-log-manager.h | 2 +- libempathy/empathy-message.c | 118 +++++++++--------------- libempathy/empathy-message.h | 55 +++++------ libempathy/empathy-tp-call.c | 20 ++-- libempathy/empathy-tp-call.h | 5 +- libempathy/empathy-tp-chat.c | 24 ++--- libempathy/empathy-tp-chat.h | 4 +- libempathy/empathy-tp-contact-factory.c | 15 ++- libempathy/empathy-tp-contact-factory.h | 2 +- libempathy/empathy-tp-contact-list.c | 14 ++- libempathy/empathy-tp-contact-list.h | 4 +- libempathy/empathy-tp-group.c | 15 ++- libempathy/empathy-tp-group.h | 4 +- libempathy/empathy-tp-roomlist.c | 15 ++- libempathy/empathy-tp-roomlist.h | 4 +- libempathy/empathy-tp-tube.c | 15 ++- libempathy/empathy-tp-tube.h | 1 + libempathy/empathy-utils.h | 1 + megaphone/src/megaphone-applet.c | 13 ++- megaphone/src/megaphone-applet.h | 1 + python/pyempathy/pyempathy.defs | 52 ++++++----- src/empathy-chat-window.c | 31 +++---- src/empathy-chat-window.h | 2 +- src/empathy-filter.c | 15 ++- src/empathy-filter.h | 4 +- src/empathy-status-icon.c | 14 ++- src/empathy-status-icon.h | 4 +- 78 files changed, 487 insertions(+), 587 deletions(-) diff --git a/libempathy-gtk/empathy-account-chooser.c b/libempathy-gtk/empathy-account-chooser.c index f46f4cec6..13040b0dc 100644 --- a/libempathy-gtk/empathy-account-chooser.c +++ b/libempathy-gtk/empathy-account-chooser.c @@ -38,8 +38,7 @@ #include "empathy-ui-utils.h" #include "empathy-account-chooser.h" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_ACCOUNT_CHOOSER, EmpathyAccountChooserPriv)) - +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountChooser) typedef struct { MissionControl *mc; McAccountMonitor *monitor; @@ -130,8 +129,10 @@ empathy_account_chooser_class_init (EmpathyAccountChooserClass *klass) static void empathy_account_chooser_init (EmpathyAccountChooser *chooser) { - EmpathyAccountChooserPriv *priv = GET_PRIV (chooser); + EmpathyAccountChooserPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (chooser, + EMPATHY_TYPE_ACCOUNT_CHOOSER, EmpathyAccountChooserPriv); + chooser->priv = priv; priv->set_active_item = FALSE; priv->filter = NULL; priv->filter_data = NULL; diff --git a/libempathy-gtk/empathy-account-chooser.h b/libempathy-gtk/empathy-account-chooser.h index 15f6ad2ca..c15923bc3 100644 --- a/libempathy-gtk/empathy-account-chooser.h +++ b/libempathy-gtk/empathy-account-chooser.h @@ -47,6 +47,7 @@ typedef struct _EmpathyAccountChooserClass EmpathyAccountChooserClass; struct _EmpathyAccountChooser { GtkComboBox parent; + gpointer priv; }; struct _EmpathyAccountChooserClass { diff --git a/libempathy-gtk/empathy-avatar-chooser.c b/libempathy-gtk/empathy-avatar-chooser.c index c6021b73f..b0142d72d 100644 --- a/libempathy-gtk/empathy-avatar-chooser.c +++ b/libempathy-gtk/empathy-avatar-chooser.c @@ -29,6 +29,7 @@ #include #include +#include #include "empathy-avatar-chooser.h" #include "empathy-conf.h" #include "empathy-ui-utils.h" @@ -36,12 +37,11 @@ #define DEBUG_FLAG EMPATHY_DEBUG_OTHER #include -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_AVATAR_CHOOSER, EmpathyAvatarChooserPriv)) - #define AVATAR_SIZE_SAVE 96 #define AVATAR_SIZE_VIEW 64 #define DEFAULT_DIR DATADIR"/pixmaps/faces" +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAvatarChooser) typedef struct { gchar *image_data; gsize image_data_size; @@ -122,10 +122,10 @@ empathy_avatar_chooser_class_init (EmpathyAvatarChooserClass *klass) static void empathy_avatar_chooser_init (EmpathyAvatarChooser *chooser) { - EmpathyAvatarChooserPriv *priv; - - priv = GET_PRIV (chooser); + EmpathyAvatarChooserPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (chooser, + EMPATHY_TYPE_AVATAR_CHOOSER, EmpathyAvatarChooserPriv); + chooser->priv = priv; gtk_drag_dest_set (GTK_WIDGET (chooser), GTK_DEST_DEFAULT_ALL, drop_types, diff --git a/libempathy-gtk/empathy-avatar-chooser.h b/libempathy-gtk/empathy-avatar-chooser.h index 5060ae593..7db880df7 100644 --- a/libempathy-gtk/empathy-avatar-chooser.h +++ b/libempathy-gtk/empathy-avatar-chooser.h @@ -38,10 +38,10 @@ G_BEGIN_DECLS typedef struct _EmpathyAvatarChooser EmpathyAvatarChooser; typedef struct _EmpathyAvatarChooserClass EmpathyAvatarChooserClass; -typedef struct _EmpathyAvatarChooserPrivate EmpathyAvatarChooserPrivate; struct _EmpathyAvatarChooser { GtkButton parent; + gpointer priv; }; struct _EmpathyAvatarChooserClass { diff --git a/libempathy-gtk/empathy-avatar-image.c b/libempathy-gtk/empathy-avatar-image.c index 17ab19091..7dd93aad9 100644 --- a/libempathy-gtk/empathy-avatar-image.c +++ b/libempathy-gtk/empathy-avatar-image.c @@ -29,14 +29,14 @@ #include #include +#include #include "empathy-avatar-image.h" #include "empathy-ui-utils.h" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_AVATAR_IMAGE, EmpathyAvatarImagePriv)) - #define MAX_SMALL 64 #define MAX_LARGE 400 +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAvatarImage) typedef struct { GtkWidget *image; GtkWidget *popup; @@ -73,10 +73,10 @@ empathy_avatar_image_class_init (EmpathyAvatarImageClass *klass) static void empathy_avatar_image_init (EmpathyAvatarImage *avatar_image) { - EmpathyAvatarImagePriv *priv; - - priv = GET_PRIV (avatar_image); + EmpathyAvatarImagePriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (avatar_image, + EMPATHY_TYPE_AVATAR_IMAGE, EmpathyAvatarImagePriv); + avatar_image->priv = priv; priv->image = gtk_image_new (); gtk_container_add (GTK_CONTAINER (avatar_image), priv->image); empathy_avatar_image_set (avatar_image, NULL); diff --git a/libempathy-gtk/empathy-avatar-image.h b/libempathy-gtk/empathy-avatar-image.h index 63c3eca45..bd83e4bb8 100644 --- a/libempathy-gtk/empathy-avatar-image.h +++ b/libempathy-gtk/empathy-avatar-image.h @@ -42,6 +42,7 @@ typedef struct _EmpathyAvatarImageClass EmpathyAvatarImageClass; struct _EmpathyAvatarImage { GtkEventBox parent; + gpointer priv; }; struct _EmpathyAvatarImageClass { diff --git a/libempathy-gtk/empathy-cell-renderer-expander.c b/libempathy-gtk/empathy-cell-renderer-expander.c index 51930ab6a..fc9189d2d 100644 --- a/libempathy-gtk/empathy-cell-renderer-expander.c +++ b/libempathy-gtk/empathy-cell-renderer-expander.c @@ -31,12 +31,31 @@ #include +#include #include "empathy-cell-renderer-expander.h" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CELL_RENDERER_EXPANDER, EmpathyCellRendererExpanderPriv)) +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyCellRendererExpander) +typedef struct { + GtkExpanderStyle expander_style; + gint expander_size; + + GtkTreeView *animation_view; + GtkTreeRowReference *animation_node; + GtkExpanderStyle animation_style; + guint animation_timeout; + GdkRectangle animation_area; + + guint activatable : 1; + guint animation_expanding : 1; +} EmpathyCellRendererExpanderPriv; + +enum { + PROP_0, + PROP_EXPANDER_STYLE, + PROP_EXPANDER_SIZE, + PROP_ACTIVATABLE +}; -static void empathy_cell_renderer_expander_init (EmpathyCellRendererExpander *expander); -static void empathy_cell_renderer_expander_class_init (EmpathyCellRendererExpanderClass *klass); static void empathy_cell_renderer_expander_get_property (GObject *object, guint param_id, GValue *value, @@ -68,38 +87,15 @@ static gboolean empathy_cell_renderer_expander_activate (GtkCellRenderer GdkRectangle *cell_area, GtkCellRendererState flags); -enum { - PROP_0, - PROP_EXPANDER_STYLE, - PROP_EXPANDER_SIZE, - PROP_ACTIVATABLE -}; - -typedef struct _EmpathyCellRendererExpanderPriv EmpathyCellRendererExpanderPriv; - -struct _EmpathyCellRendererExpanderPriv { - GtkExpanderStyle expander_style; - gint expander_size; - - GtkTreeView *animation_view; - GtkTreeRowReference *animation_node; - GtkExpanderStyle animation_style; - guint animation_timeout; - GdkRectangle animation_area; - - guint activatable : 1; - guint animation_expanding : 1; -}; - G_DEFINE_TYPE (EmpathyCellRendererExpander, empathy_cell_renderer_expander, GTK_TYPE_CELL_RENDERER) static void empathy_cell_renderer_expander_init (EmpathyCellRendererExpander *expander) { - EmpathyCellRendererExpanderPriv *priv; - - priv = GET_PRIV (expander); + EmpathyCellRendererExpanderPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (expander, + EMPATHY_TYPE_CELL_RENDERER_EXPANDER, EmpathyCellRendererExpanderPriv); + expander->priv = priv; priv->expander_style = GTK_EXPANDER_COLLAPSED; priv->expander_size = 12; priv->activatable = TRUE; diff --git a/libempathy-gtk/empathy-cell-renderer-expander.h b/libempathy-gtk/empathy-cell-renderer-expander.h index d7e5f74b0..d052612bf 100644 --- a/libempathy-gtk/empathy-cell-renderer-expander.h +++ b/libempathy-gtk/empathy-cell-renderer-expander.h @@ -39,6 +39,7 @@ typedef struct _EmpathyCellRendererExpanderClass EmpathyCellRendererExpanderClas struct _EmpathyCellRendererExpander { GtkCellRenderer parent; + gpointer priv; }; struct _EmpathyCellRendererExpanderClass { diff --git a/libempathy-gtk/empathy-cell-renderer-text.c b/libempathy-gtk/empathy-cell-renderer-text.c index d48de32b8..c31a013aa 100644 --- a/libempathy-gtk/empathy-cell-renderer-text.c +++ b/libempathy-gtk/empathy-cell-renderer-text.c @@ -24,11 +24,11 @@ #include +#include #include "empathy-cell-renderer-text.h" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CELL_RENDERER_TEXT, EmpathyCellRendererTextPriv)) - -struct _EmpathyCellRendererTextPriv { +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyCellRendererText) +typedef struct { gchar *name; gchar *status; gboolean is_group; @@ -37,10 +37,8 @@ struct _EmpathyCellRendererTextPriv { gboolean is_selected; gboolean show_status; -}; +} EmpathyCellRendererTextPriv; -static void empathy_cell_renderer_text_class_init (EmpathyCellRendererTextClass *klass); -static void empathy_cell_renderer_text_init (EmpathyCellRendererText *cell); static void cell_renderer_text_finalize (GObject *object); static void cell_renderer_text_get_property (GObject *object, guint param_id, @@ -131,10 +129,10 @@ empathy_cell_renderer_text_class_init (EmpathyCellRendererTextClass *klass) static void empathy_cell_renderer_text_init (EmpathyCellRendererText *cell) { - EmpathyCellRendererTextPriv *priv; - - priv = GET_PRIV (cell); + EmpathyCellRendererTextPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (cell, + EMPATHY_TYPE_CELL_RENDERER_TEXT, EmpathyCellRendererTextPriv); + cell->priv = priv; g_object_set (cell, "ellipsize", PANGO_ELLIPSIZE_END, NULL); diff --git a/libempathy-gtk/empathy-cell-renderer-text.h b/libempathy-gtk/empathy-cell-renderer-text.h index 76cef3120..7de8b2d08 100644 --- a/libempathy-gtk/empathy-cell-renderer-text.h +++ b/libempathy-gtk/empathy-cell-renderer-text.h @@ -36,12 +36,10 @@ G_BEGIN_DECLS typedef struct _EmpathyCellRendererText EmpathyCellRendererText; typedef struct _EmpathyCellRendererTextClass EmpathyCellRendererTextClass; -typedef struct _EmpathyCellRendererTextPriv EmpathyCellRendererTextPriv; struct _EmpathyCellRendererText { - GtkCellRendererText parent; - - EmpathyCellRendererTextPriv *priv; + GtkCellRendererText parent; + gpointer priv; }; struct _EmpathyCellRendererTextClass { diff --git a/libempathy-gtk/empathy-chat-view.c b/libempathy-gtk/empathy-chat-view.c index 491de2269..2131cecb4 100644 --- a/libempathy-gtk/empathy-chat-view.c +++ b/libempathy-gtk/empathy-chat-view.c @@ -61,9 +61,8 @@ #define MAX_SCROLL_TIME 0.4 /* seconds */ #define SCROLL_DELAY 33 /* milliseconds */ -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CHAT_VIEW, EmpathyChatViewPriv)) - -struct _EmpathyChatViewPriv { +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyChatView) +typedef struct { GtkTextBuffer *buffer; EmpathyTheme *theme; @@ -86,10 +85,8 @@ struct _EmpathyChatViewPriv { guint notify_system_fonts_id; guint notify_show_avatars_id; -}; +} EmpathyChatViewPriv; -static void empathy_chat_view_class_init (EmpathyChatViewClass *klass); -static void empathy_chat_view_init (EmpathyChatView *view); static void chat_view_finalize (GObject *object); static gboolean chat_view_drag_motion (GtkWidget *widget, GdkDragContext *context, @@ -148,11 +145,11 @@ empathy_chat_view_class_init (EmpathyChatViewClass *klass) static void empathy_chat_view_init (EmpathyChatView *view) { - EmpathyChatViewPriv *priv; - gboolean show_avatars; - - priv = GET_PRIV (view); + gboolean show_avatars; + EmpathyChatViewPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (view, + EMPATHY_TYPE_CHAT_VIEW, EmpathyChatViewPriv); + view->priv = priv; priv->buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); priv->last_timestamp = 0; priv->allow_scrolling = TRUE; diff --git a/libempathy-gtk/empathy-chat-view.h b/libempathy-gtk/empathy-chat-view.h index 9002d40fc..0c54abdc7 100644 --- a/libempathy-gtk/empathy-chat-view.h +++ b/libempathy-gtk/empathy-chat-view.h @@ -41,12 +41,12 @@ G_BEGIN_DECLS typedef struct _EmpathyChatView EmpathyChatView; typedef struct _EmpathyChatViewClass EmpathyChatViewClass; -typedef struct _EmpathyChatViewPriv EmpathyChatViewPriv; #include "empathy-theme.h" struct _EmpathyChatView { GtkTextView parent; + gpointer priv; }; struct _EmpathyChatViewClass { diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 1b2ed9d43..958bb9a3b 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -53,15 +53,14 @@ #define DEBUG_FLAG EMPATHY_DEBUG_CHAT #include -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CHAT, EmpathyChatPriv)) - #define CHAT_DIR_CREATE_MODE (S_IRUSR | S_IWUSR | S_IXUSR) #define CHAT_FILE_CREATE_MODE (S_IRUSR | S_IWUSR) #define IS_ENTER(v) (v == GDK_Return || v == GDK_ISO_Enter || v == GDK_KP_Enter) #define MAX_INPUT_HEIGHT 150 #define COMPOSING_STOP_TIMEOUT 5 -struct _EmpathyChatPriv { +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyChat) +typedef struct { EmpathyTpChat *tp_chat; McAccount *account; gchar *id; @@ -92,10 +91,7 @@ struct _EmpathyChatPriv { GtkWidget *hbox_topic; GtkWidget *label_topic; GtkWidget *contact_list_view; -}; - -static void empathy_chat_class_init (EmpathyChatClass *klass); -static void empathy_chat_init (EmpathyChat *chat); +} EmpathyChatPriv; enum { COMPOSING, @@ -1532,8 +1528,10 @@ chat_block_events_timeout_cb (gpointer data) static void empathy_chat_init (EmpathyChat *chat) { - EmpathyChatPriv *priv = GET_PRIV (chat); + EmpathyChatPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (chat, + EMPATHY_TYPE_CHAT, EmpathyChatPriv); + chat->priv = priv; priv->log_manager = empathy_log_manager_new (); priv->contacts_width = -1; priv->sent_messages = NULL; diff --git a/libempathy-gtk/empathy-chat.h b/libempathy-gtk/empathy-chat.h index 5af9d609b..b7b6968f9 100644 --- a/libempathy-gtk/empathy-chat.h +++ b/libempathy-gtk/empathy-chat.h @@ -47,10 +47,10 @@ G_BEGIN_DECLS typedef struct _EmpathyChat EmpathyChat; typedef struct _EmpathyChatClass EmpathyChatClass; -typedef struct _EmpathyChatPriv EmpathyChatPriv; struct _EmpathyChat { GtkBin parent; + gpointer priv; /* Protected */ EmpathyChatView *view; diff --git a/libempathy-gtk/empathy-conf.c b/libempathy-gtk/empathy-conf.c index 0ecb8e166..fae2c37db 100644 --- a/libempathy-gtk/empathy-conf.c +++ b/libempathy-gtk/empathy-conf.c @@ -26,6 +26,7 @@ #include +#include #include "empathy-conf.h" #define DEBUG_FLAG EMPATHY_DEBUG_OTHER @@ -34,8 +35,7 @@ #define EMPATHY_CONF_ROOT "/apps/empathy" #define DESKTOP_INTERFACE_ROOT "/desktop/gnome/interface" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CONF, EmpathyConfPriv)) - +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyConf) typedef struct { GConfClient *gconf_client; } EmpathyConfPriv; @@ -67,10 +67,10 @@ empathy_conf_class_init (EmpathyConfClass *class) static void empathy_conf_init (EmpathyConf *conf) { - EmpathyConfPriv *priv; - - priv = GET_PRIV (conf); + EmpathyConfPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (conf, + EMPATHY_TYPE_CONF, EmpathyConfPriv); + conf->priv = priv; priv->gconf_client = gconf_client_get_default (); gconf_client_add_dir (priv->gconf_client, diff --git a/libempathy-gtk/empathy-conf.h b/libempathy-gtk/empathy-conf.h index a0ade22ee..fb0c5bcad 100644 --- a/libempathy-gtk/empathy-conf.h +++ b/libempathy-gtk/empathy-conf.h @@ -37,6 +37,7 @@ typedef struct _EmpathyConfClass EmpathyConfClass; struct _EmpathyConf { GObject parent; + gpointer priv; }; struct _EmpathyConfClass { diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c index e18675295..d4946e4a7 100644 --- a/libempathy-gtk/empathy-contact-list-store.c +++ b/libempathy-gtk/empathy-contact-list-store.c @@ -32,6 +32,7 @@ #include +#include #include "empathy-contact-list-store.h" #include "empathy-ui-utils.h" #include "empathy-gtk-enum-types.h" @@ -49,8 +50,7 @@ /* Time in seconds after connecting which we wait before active users are enabled */ #define ACTIVE_USER_WAIT_TO_ENABLE_TIME 5 -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CONTACT_LIST_STORE, EmpathyContactListStorePriv)) - +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyContactListStore) typedef struct { EmpathyContactList *list; gboolean show_offline; @@ -80,8 +80,6 @@ typedef struct { gboolean remove; } ShowActiveData; -static void empathy_contact_list_store_class_init (EmpathyContactListStoreClass *klass); -static void empathy_contact_list_store_init (EmpathyContactListStore *list); static void contact_list_store_finalize (GObject *object); static void contact_list_store_get_property (GObject *object, guint param_id, @@ -272,10 +270,10 @@ empathy_contact_list_store_class_init (EmpathyContactListStoreClass *klass) static void empathy_contact_list_store_init (EmpathyContactListStore *store) { - EmpathyContactListStorePriv *priv; - - priv = GET_PRIV (store); + EmpathyContactListStorePriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (store, + EMPATHY_TYPE_CONTACT_LIST_STORE, EmpathyContactListStorePriv); + store->priv = priv; priv->show_avatars = TRUE; priv->show_groups = TRUE; priv->inhibit_active = g_timeout_add_seconds (ACTIVE_USER_WAIT_TO_ENABLE_TIME, diff --git a/libempathy-gtk/empathy-contact-list-store.h b/libempathy-gtk/empathy-contact-list-store.h index 04abb6dd0..10354ff11 100644 --- a/libempathy-gtk/empathy-contact-list-store.h +++ b/libempathy-gtk/empathy-contact-list-store.h @@ -66,6 +66,7 @@ typedef enum { struct _EmpathyContactListStore { GtkTreeStore parent; + gpointer priv; }; struct _EmpathyContactListStoreClass { diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index 1a9890b79..90598d393 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -58,8 +58,7 @@ * (e.g. online, offline or from normal to a busy state). */ -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CONTACT_LIST_VIEW, EmpathyContactListViewPriv)) - +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyContactListView) typedef struct { EmpathyContactListStore *store; GtkTreeRowReference *drag_row; @@ -1014,6 +1013,10 @@ empathy_contact_list_view_class_init (EmpathyContactListViewClass *klass) static void empathy_contact_list_view_init (EmpathyContactListView *view) { + EmpathyContactListViewPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (view, + EMPATHY_TYPE_CONTACT_LIST_VIEW, EmpathyContactListViewPriv); + + view->priv = priv; /* Get saved group states. */ empathy_contact_groups_get_all (); diff --git a/libempathy-gtk/empathy-contact-list-view.h b/libempathy-gtk/empathy-contact-list-view.h index 47159fd24..39dc5966b 100644 --- a/libempathy-gtk/empathy-contact-list-view.h +++ b/libempathy-gtk/empathy-contact-list-view.h @@ -57,11 +57,12 @@ typedef enum { } EmpathyContactListFeatureFlags; struct _EmpathyContactListView { - GtkTreeView parent; + GtkTreeView parent; + gpointer priv; }; struct _EmpathyContactListViewClass { - GtkTreeViewClass parent_class; + GtkTreeViewClass parent_class; }; GType empathy_contact_list_view_get_type (void) G_GNUC_CONST; diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c index d22eee993..0af2238df 100644 --- a/libempathy-gtk/empathy-presence-chooser.c +++ b/libempathy-gtk/empathy-presence-chooser.c @@ -42,11 +42,10 @@ #include "empathy-images.h" #include "empathy-presence-chooser.h" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_PRESENCE_CHOOSER, EmpathyPresenceChooserPriv)) - /* Flashing delay for icons (milliseconds). */ #define FLASH_TIMEOUT 500 +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyPresenceChooser) typedef struct { EmpathyIdle *idle; @@ -97,8 +96,6 @@ static guint states[] = {MC_PRESENCE_AVAILABLE, TRUE, MC_PRESENCE_HIDDEN, FALSE, MC_PRESENCE_OFFLINE, FALSE}; -static void empathy_presence_chooser_class_init (EmpathyPresenceChooserClass *klass); -static void empathy_presence_chooser_init (EmpathyPresenceChooser *chooser); static void presence_chooser_finalize (GObject *object); static void presence_chooser_presence_changed_cb (EmpathyPresenceChooser *chooser); static void presence_chooser_reset_scroll_timeout (EmpathyPresenceChooser *chooser); @@ -159,12 +156,12 @@ empathy_presence_chooser_class_init (EmpathyPresenceChooserClass *klass) static void empathy_presence_chooser_init (EmpathyPresenceChooser *chooser) { - EmpathyPresenceChooserPriv *priv; - GtkWidget *arrow; - GtkWidget *alignment; - - priv = GET_PRIV (chooser); + GtkWidget *arrow; + GtkWidget *alignment; + EmpathyPresenceChooserPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (chooser, + EMPATHY_TYPE_PRESENCE_CHOOSER, EmpathyPresenceChooserPriv); + chooser->priv = priv; gtk_button_set_relief (GTK_BUTTON (chooser), GTK_RELIEF_NONE); gtk_button_set_focus_on_click (GTK_BUTTON (chooser), FALSE); diff --git a/libempathy-gtk/empathy-presence-chooser.h b/libempathy-gtk/empathy-presence-chooser.h index a04458d83..8bf8de5b5 100644 --- a/libempathy-gtk/empathy-presence-chooser.h +++ b/libempathy-gtk/empathy-presence-chooser.h @@ -41,6 +41,7 @@ typedef struct _EmpathyPresenceChooserClass EmpathyPresenceChooserClass; struct _EmpathyPresenceChooser { GtkToggleButton parent; + gpointer priv; }; struct _EmpathyPresenceChooserClass { diff --git a/libempathy-gtk/empathy-smiley-manager.c b/libempathy-gtk/empathy-smiley-manager.c index 7d2a744a1..c9322c8eb 100644 --- a/libempathy-gtk/empathy-smiley-manager.c +++ b/libempathy-gtk/empathy-smiley-manager.c @@ -24,26 +24,24 @@ #include +#include #include "empathy-smiley-manager.h" #include "empathy-ui-utils.h" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - EMPATHY_TYPE_SMILEY_MANAGER, EmpathySmileyManagerPriv)) +typedef struct _SmileyManagerTree SmileyManagerTree; +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathySmileyManager) typedef struct { + SmileyManagerTree *tree; + GSList *smileys; +} EmpathySmileyManagerPriv; + +struct _SmileyManagerTree { gunichar c; GdkPixbuf *pixbuf; GSList *childrens; -} SmileyManagerTree; - -struct _EmpathySmileyManagerPriv { - SmileyManagerTree *tree; - GSList *smileys; }; -static void empathy_smiley_manager_class_init (EmpathySmileyManagerClass *klass); -static void empathy_smiley_manager_init (EmpathySmileyManager *manager); - G_DEFINE_TYPE (EmpathySmileyManager, empathy_smiley_manager, G_TYPE_OBJECT); static SmileyManagerTree * @@ -130,8 +128,10 @@ empathy_smiley_manager_class_init (EmpathySmileyManagerClass *klass) static void empathy_smiley_manager_init (EmpathySmileyManager *manager) { - EmpathySmileyManagerPriv *priv = GET_PRIV (manager); + EmpathySmileyManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager, + EMPATHY_TYPE_SMILEY_MANAGER, EmpathySmileyManagerPriv); + manager->priv = priv; priv->tree = smiley_manager_tree_new ('\0'); priv->smileys = NULL; } diff --git a/libempathy-gtk/empathy-smiley-manager.h b/libempathy-gtk/empathy-smiley-manager.h index 1847e1a28..394215ed6 100644 --- a/libempathy-gtk/empathy-smiley-manager.h +++ b/libempathy-gtk/empathy-smiley-manager.h @@ -37,10 +37,10 @@ G_BEGIN_DECLS typedef struct _EmpathySmileyManager EmpathySmileyManager; typedef struct _EmpathySmileyManagerClass EmpathySmileyManagerClass; -typedef struct _EmpathySmileyManagerPriv EmpathySmileyManagerPriv; struct _EmpathySmileyManager { GObject parent; + gpointer priv; }; struct _EmpathySmileyManagerClass { diff --git a/libempathy-gtk/empathy-theme-boxes.c b/libempathy-gtk/empathy-theme-boxes.c index a2466cdcf..8d3a813bd 100644 --- a/libempathy-gtk/empathy-theme-boxes.c +++ b/libempathy-gtk/empathy-theme-boxes.c @@ -25,6 +25,7 @@ #include #include +#include #include "empathy-ui-utils.h" #include "empathy-theme-boxes.h" @@ -34,11 +35,8 @@ #define MARGIN 4 #define HEADER_PADDING 2 -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_THEME_BOXES, EmpathyThemeBoxesPriv)) - -typedef struct _EmpathyThemeBoxesPriv EmpathyThemeBoxesPriv; - -struct _EmpathyThemeBoxesPriv { +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyThemeBoxes) +typedef struct { gchar *header_foreground; gchar *header_background; gchar *header_line_background; @@ -50,7 +48,7 @@ struct _EmpathyThemeBoxesPriv { gchar *event_foreground; gchar *invite_foreground; gchar *link_foreground; -}; +} EmpathyThemeBoxesPriv; static void theme_boxes_finalize (GObject *object); static void theme_boxes_get_property (GObject *object, @@ -215,9 +213,10 @@ empathy_theme_boxes_class_init (EmpathyThemeBoxesClass *class) static void empathy_theme_boxes_init (EmpathyThemeBoxes *theme) { - EmpathyThemeBoxesPriv *priv; + EmpathyThemeBoxesPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (theme, + EMPATHY_TYPE_THEME_BOXES, EmpathyThemeBoxesPriv); - priv = GET_PRIV (theme); + theme->priv = priv; } static void @@ -672,7 +671,7 @@ theme_boxes_append_message (EmpathyTheme *theme, sender = empathy_message_get_sender (message); - if (empathy_message_get_type (message) == EMPATHY_MESSAGE_TYPE_ACTION) { + if (empathy_message_get_tptype (message) == TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION) { gchar *body; body = g_strdup_printf (" * %s %s", diff --git a/libempathy-gtk/empathy-theme-boxes.h b/libempathy-gtk/empathy-theme-boxes.h index b1f0033f3..5f6d15cd2 100644 --- a/libempathy-gtk/empathy-theme-boxes.h +++ b/libempathy-gtk/empathy-theme-boxes.h @@ -39,6 +39,7 @@ typedef struct _EmpathyThemeBoxesClass EmpathyThemeBoxesClass; struct _EmpathyThemeBoxes { EmpathyTheme parent; + gpointer priv; }; struct _EmpathyThemeBoxesClass { diff --git a/libempathy-gtk/empathy-theme-irc.c b/libempathy-gtk/empathy-theme-irc.c index 52ebb18fa..fd315b2b1 100644 --- a/libempathy-gtk/empathy-theme-irc.c +++ b/libempathy-gtk/empathy-theme-irc.c @@ -22,17 +22,15 @@ #include +#include #include "empathy-chat.h" #include "empathy-ui-utils.h" #include "empathy-theme-irc.h" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_THEME_IRC, EmpathyThemeIrcPriv)) - -typedef struct _EmpathyThemeIrcPriv EmpathyThemeIrcPriv; - -struct _EmpathyThemeIrcPriv { +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyThemeIrc) +typedef struct { gint my_prop; -}; +} EmpathyThemeIrcPriv; static void theme_irc_finalize (GObject *object); static void theme_irc_update_view (EmpathyTheme *theme, @@ -80,11 +78,12 @@ empathy_theme_irc_class_init (EmpathyThemeIrcClass *class) } static void -empathy_theme_irc_init (EmpathyThemeIrc *presence) +empathy_theme_irc_init (EmpathyThemeIrc *theme) { - EmpathyThemeIrcPriv *priv; + EmpathyThemeIrcPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (theme, + EMPATHY_TYPE_THEME_IRC, EmpathyThemeIrcPriv); - priv = GET_PRIV (presence); + theme->priv = priv; } static void @@ -192,7 +191,7 @@ theme_irc_append_message (EmpathyTheme *theme, contact = empathy_message_get_sender (message); name = empathy_contact_get_name (contact); - if (empathy_message_get_type (message) == EMPATHY_MESSAGE_TYPE_ACTION) { + if (empathy_message_get_tptype (message) == TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION) { if (empathy_contact_is_user (contact)) { body_tag = "irc-action-self"; } else { diff --git a/libempathy-gtk/empathy-theme-irc.h b/libempathy-gtk/empathy-theme-irc.h index dc52a56c5..0dbe15528 100644 --- a/libempathy-gtk/empathy-theme-irc.h +++ b/libempathy-gtk/empathy-theme-irc.h @@ -39,6 +39,7 @@ typedef struct _EmpathyThemeIrcClass EmpathyThemeIrcClass; struct _EmpathyThemeIrc { EmpathyTheme parent; + gpointer priv; }; struct _EmpathyThemeIrcClass { diff --git a/libempathy-gtk/empathy-theme-manager.c b/libempathy-gtk/empathy-theme-manager.c index 09b68e0a7..1bcb4204f 100644 --- a/libempathy-gtk/empathy-theme-manager.c +++ b/libempathy-gtk/empathy-theme-manager.c @@ -34,8 +34,7 @@ #include "empathy-theme-irc.h" #include "empathy-theme-manager.h" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_THEME_MANAGER, EmpathyThemeManagerPriv)) - +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyThemeManager) typedef struct { gchar *name; guint name_notify_id; @@ -211,10 +210,10 @@ empathy_theme_manager_class_init (EmpathyThemeManagerClass *klass) static void empathy_theme_manager_init (EmpathyThemeManager *manager) { - EmpathyThemeManagerPriv *priv; - - priv = GET_PRIV (manager); + EmpathyThemeManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager, + EMPATHY_TYPE_THEME_MANAGER, EmpathyThemeManagerPriv); + manager->priv = priv; priv->name_notify_id = empathy_conf_notify_add (empathy_conf_get (), EMPATHY_PREFS_CHAT_THEME, diff --git a/libempathy-gtk/empathy-theme-manager.h b/libempathy-gtk/empathy-theme-manager.h index 6bd2d41f5..5c0f579b9 100644 --- a/libempathy-gtk/empathy-theme-manager.h +++ b/libempathy-gtk/empathy-theme-manager.h @@ -36,7 +36,8 @@ typedef struct _EmpathyThemeManager EmpathyThemeManager; typedef struct _EmpathyThemeManagerClass EmpathyThemeManagerClass; struct _EmpathyThemeManager { - GObject parent; + GObject parent; + gpointer priv; }; struct _EmpathyThemeManagerClass { diff --git a/libempathy-gtk/empathy-theme.c b/libempathy-gtk/empathy-theme.c index b3638476c..b1afa51ca 100644 --- a/libempathy-gtk/empathy-theme.c +++ b/libempathy-gtk/empathy-theme.c @@ -34,14 +34,11 @@ /* Number of seconds between timestamps when using normal mode, 5 minutes. */ #define TIMESTAMP_INTERVAL 300 -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_THEME, EmpathyThemePriv)) - -typedef struct _EmpathyThemePriv EmpathyThemePriv; - -struct _EmpathyThemePriv { +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTheme) +typedef struct { EmpathySmileyManager *smiley_manager; gboolean show_avatars; -}; +} EmpathyThemePriv; static void theme_finalize (GObject *object); static void theme_get_property (GObject *object, @@ -89,12 +86,12 @@ empathy_theme_class_init (EmpathyThemeClass *class) } static void -empathy_theme_init (EmpathyTheme *presence) +empathy_theme_init (EmpathyTheme *theme) { - EmpathyThemePriv *priv; - - priv = GET_PRIV (presence); + EmpathyThemePriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (theme, + EMPATHY_TYPE_THEME, EmpathyThemePriv); + theme->priv = priv; priv->smiley_manager = empathy_smiley_manager_new (); } diff --git a/libempathy-gtk/empathy-theme.h b/libempathy-gtk/empathy-theme.h index 34875bcb4..f82c18afc 100644 --- a/libempathy-gtk/empathy-theme.h +++ b/libempathy-gtk/empathy-theme.h @@ -40,6 +40,7 @@ typedef struct _EmpathyThemeClass EmpathyThemeClass; struct _EmpathyTheme { GObject parent; + gpointer priv; }; struct _EmpathyThemeClass { 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 \ "\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 #include -#include -#include -#include #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 { diff --git a/megaphone/src/megaphone-applet.c b/megaphone/src/megaphone-applet.c index 24d3e07cf..5deeb6c98 100644 --- a/megaphone/src/megaphone-applet.c +++ b/megaphone/src/megaphone-applet.c @@ -51,18 +51,15 @@ #define DEBUG_FLAG EMPATHY_DEBUG_OTHER #include -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MEGAPHONE_TYPE_APPLET, MegaphoneAppletPriv)) - -typedef struct _MegaphoneAppletPriv MegaphoneAppletPriv; - -struct _MegaphoneAppletPriv { +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, MegaphoneApplet) +typedef struct { EmpathyContactFactory *factory; GtkWidget *image; gint image_size; EmpathyContact *contact; GConfClient *gconf; guint gconf_cnxn; -}; +} MegaphoneAppletPriv; static void megaphone_applet_finalize (GObject *object); static void megaphone_applet_size_allocate_cb (GtkWidget *widget, @@ -111,8 +108,10 @@ megaphone_applet_class_init (MegaphoneAppletClass *class) static void megaphone_applet_init (MegaphoneApplet *applet) { - MegaphoneAppletPriv *priv = GET_PRIV (applet); + MegaphoneAppletPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (applet, + MEGAPHONE_TYPE_APPLET, MegaphoneAppletPriv); + applet->priv = priv; priv->factory = empathy_contact_factory_new (); priv->gconf = gconf_client_get_default (); diff --git a/megaphone/src/megaphone-applet.h b/megaphone/src/megaphone-applet.h index bae671d81..47d82a7d0 100644 --- a/megaphone/src/megaphone-applet.h +++ b/megaphone/src/megaphone-applet.h @@ -40,6 +40,7 @@ typedef struct _MegaphoneAppletClass MegaphoneAppletClass; struct _MegaphoneApplet { PanelApplet applet; + gpointer priv; }; struct _MegaphoneAppletClass { diff --git a/python/pyempathy/pyempathy.defs b/python/pyempathy/pyempathy.defs index b45b06bab..700d43935 100644 --- a/python/pyempathy/pyempathy.defs +++ b/python/pyempathy/pyempathy.defs @@ -172,19 +172,6 @@ ) ) -(define-enum MessageType - (in-module "Empathy") - (c-name "EmpathyMessageType") - (gtype-id "EMPATHY_TYPE_MESSAGE_TYPE") - (values - '("normal" "EMPATHY_MESSAGE_TYPE_NORMAL") - '("action" "EMPATHY_MESSAGE_TYPE_ACTION") - '("notice" "EMPATHY_MESSAGE_TYPE_NOTICE") - '("auto-reply" "EMPATHY_MESSAGE_TYPE_AUTO_REPLY") - '("last" "EMPATHY_MESSAGE_TYPE_LAST") - ) -) - (define-flags Capabilities (in-module "Empathy") (c-name "EmpathyCapabilities") @@ -622,8 +609,8 @@ ;; From empathy-message.h -(define-function empathy_message_get_gtype - (c-name "empathy_message_get_gtype") +(define-function empathy_message_get_type + (c-name "empathy_message_get_type") (return-type "GType") ) @@ -636,18 +623,18 @@ ) ) -(define-method get_type +(define-method get_tptype (of-object "EmpathyMessage") - (c-name "empathy_message_get_type") - (return-type "EmpathyMessageType") + (c-name "empathy_message_get_tptype") + (return-type "TpChannelTextMessageType") ) -(define-method set_type +(define-method set_tptype (of-object "EmpathyMessage") - (c-name "empathy_message_set_type") + (c-name "empathy_message_set_tptype") (return-type "none") (parameters - '("EmpathyMessageType" "type") + '("TpChannelTextMessageType" "type") ) ) @@ -728,16 +715,18 @@ (define-function empathy_message_type_from_str (c-name "empathy_message_type_from_str") - (return-type "EmpathyMessageType") + (return-type "TpChannelTextMessageType") (parameters '("const-gchar*" "type_str") ) ) -(define-method to_str - (of-object "EmpathyMessageType") +(define-function empathy_message_type_to_str (c-name "empathy_message_type_to_str") (return-type "const-gchar*") + (parameters + '("TpChannelTextMessageType" "type") + ) ) @@ -1808,6 +1797,21 @@ ) ) +(define-method start_tone + (of-object "EmpathyTpCall") + (c-name "empathy_tp_call_start_tone") + (return-type "none") + (parameters + '("TpDTMFEvent" "event") + ) +) + +(define-method stop_tone + (of-object "EmpathyTpCall") + (c-name "empathy_tp_call_stop_tone") + (return-type "none") +) + ;; From empathy-tp-tube.h diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index bb8960479..a43e524cd 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -55,9 +55,8 @@ #define DEBUG_FLAG EMPATHY_DEBUG_CHAT #include -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CHAT_WINDOW, EmpathyChatWindowPriv)) - -struct _EmpathyChatWindowPriv { +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyChatWindow) +typedef struct { EmpathyChat *current_chat; GList *chats; GList *chats_new_msg; @@ -86,7 +85,7 @@ struct _EmpathyChatWindowPriv { GtkWidget *menu_help_contents; GtkWidget *menu_help_about; -}; +} EmpathyChatWindowPriv; static GList *chat_windows = NULL; @@ -1090,18 +1089,18 @@ empathy_chat_window_class_init (EmpathyChatWindowClass *klass) static void empathy_chat_window_init (EmpathyChatWindow *window) { - EmpathyChatWindowPriv *priv; - GladeXML *glade; - GtkAccelGroup *accel_group; - GClosure *closure; - GtkWidget *menu_conv; - GtkWidget *menu; - gint i; - GtkWidget *chat_vbox; - gchar *filename; - - priv = GET_PRIV (window); - + GladeXML *glade; + GtkAccelGroup *accel_group; + GClosure *closure; + GtkWidget *menu_conv; + GtkWidget *menu; + gint i; + GtkWidget *chat_vbox; + gchar *filename; + EmpathyChatWindowPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (window, + EMPATHY_TYPE_CHAT_WINDOW, EmpathyChatWindowPriv); + + window->priv = priv; filename = empathy_file_lookup ("empathy-chat-window.glade", "src"); glade = empathy_glade_get_file (filename, "chat_window", diff --git a/src/empathy-chat-window.h b/src/empathy-chat-window.h index 35fa09e13..8b7fe06a9 100644 --- a/src/empathy-chat-window.h +++ b/src/empathy-chat-window.h @@ -45,10 +45,10 @@ G_BEGIN_DECLS typedef struct _EmpathyChatWindow EmpathyChatWindow; typedef struct _EmpathyChatWindowClass EmpathyChatWindowClass; -typedef struct _EmpathyChatWindowPriv EmpathyChatWindowPriv; struct _EmpathyChatWindow { GObject parent; + gpointer priv; }; struct _EmpathyChatWindowClass { diff --git a/src/empathy-filter.c b/src/empathy-filter.c index 552f8939b..e1305fe11 100644 --- a/src/empathy-filter.c +++ b/src/empathy-filter.c @@ -55,19 +55,14 @@ #define DEBUG_FLAG EMPATHY_DEBUG_FILTER #include -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - EMPATHY_TYPE_FILTER, EmpathyFilterPriv)) - -struct _EmpathyFilterPriv { +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyFilter) +typedef struct { GSList *events; GHashTable *accounts; gpointer token; MissionControl *mc; GHashTable *tubes; -}; - -static void empathy_filter_class_init (EmpathyFilterClass *klass); -static void empathy_filter_init (EmpathyFilter *filter); +} EmpathyFilterPriv; G_DEFINE_TYPE (EmpathyFilter, empathy_filter, G_TYPE_OBJECT); @@ -963,9 +958,11 @@ empathy_filter_class_init (EmpathyFilterClass *klass) static void empathy_filter_init (EmpathyFilter *filter) { - EmpathyFilterPriv *priv = GET_PRIV (filter); GList *accounts, *l; + EmpathyFilterPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (filter, + EMPATHY_TYPE_FILTER, EmpathyFilterPriv); + filter->priv = priv; priv->tubes = g_hash_table_new_full (filter_channel_hash, filter_channel_equal, g_object_unref, NULL); diff --git a/src/empathy-filter.h b/src/empathy-filter.h index bf3c7461f..67b3238c3 100644 --- a/src/empathy-filter.h +++ b/src/empathy-filter.h @@ -35,10 +35,10 @@ G_BEGIN_DECLS typedef struct _EmpathyFilter EmpathyFilter; typedef struct _EmpathyFilterClass EmpathyFilterClass; -typedef struct _EmpathyFilterPriv EmpathyFilterPriv; struct _EmpathyFilter { - GObject parent; + GObject parent; + gpointer priv; }; struct _EmpathyFilterClass { diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c index aea68d4ea..bcb1f9f47 100644 --- a/src/empathy-status-icon.c +++ b/src/empathy-status-icon.c @@ -44,15 +44,11 @@ #define DEBUG_FLAG EMPATHY_DEBUG_FILTER #include -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - EMPATHY_TYPE_STATUS_ICON, EmpathyStatusIconPriv)) - /* Number of ms to wait when blinking */ #define BLINK_TIMEOUT 500 -typedef struct _StatusIconEvent StatusIconEvent; - -struct _EmpathyStatusIconPriv { +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyStatusIcon) +typedef struct { GtkStatusIcon *icon; EmpathyIdle *idle; MissionControl *mc; @@ -67,7 +63,7 @@ struct _EmpathyStatusIconPriv { GtkWidget *show_window_item; GtkWidget *message_item; GtkWidget *status_item; -}; +} EmpathyStatusIconPriv; G_DEFINE_TYPE (EmpathyStatusIcon, empathy_status_icon, G_TYPE_OBJECT); @@ -369,8 +365,10 @@ status_icon_status_changed_cb (MissionControl *mc, static void empathy_status_icon_init (EmpathyStatusIcon *icon) { - EmpathyStatusIconPriv *priv = GET_PRIV (icon); + EmpathyStatusIconPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (icon, + EMPATHY_TYPE_STATUS_ICON, EmpathyStatusIconPriv); + icon->priv = priv; priv->icon = gtk_status_icon_new (); priv->mc = empathy_mission_control_new (); priv->idle = empathy_idle_new (); diff --git a/src/empathy-status-icon.h b/src/empathy-status-icon.h index 6adf40168..bb33b1c3b 100644 --- a/src/empathy-status-icon.h +++ b/src/empathy-status-icon.h @@ -35,10 +35,10 @@ G_BEGIN_DECLS typedef struct _EmpathyStatusIcon EmpathyStatusIcon; typedef struct _EmpathyStatusIconClass EmpathyStatusIconClass; -typedef struct _EmpathyStatusIconPriv EmpathyStatusIconPriv; struct _EmpathyStatusIcon { - GObject parent; + GObject parent; + gpointer priv; }; struct _EmpathyStatusIconClass { -- cgit v1.2.3