diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-05-06 04:34:41 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-05-06 04:34:41 +0800 |
commit | 1557095113a3c0f5baadcfb1e953d73762e5263e (patch) | |
tree | 6af706fb1f4f673120981e033768a09169544c11 /libempathy-gtk | |
parent | 62828fac680bd53e0047d9ae2a281c864075c809 (diff) | |
download | gsoc2013-empathy-1557095113a3c0f5baadcfb1e953d73762e5263e.tar gsoc2013-empathy-1557095113a3c0f5baadcfb1e953d73762e5263e.tar.gz gsoc2013-empathy-1557095113a3c0f5baadcfb1e953d73762e5263e.tar.bz2 gsoc2013-empathy-1557095113a3c0f5baadcfb1e953d73762e5263e.tar.lz gsoc2013-empathy-1557095113a3c0f5baadcfb1e953d73762e5263e.tar.xz gsoc2013-empathy-1557095113a3c0f5baadcfb1e953d73762e5263e.tar.zst gsoc2013-empathy-1557095113a3c0f5baadcfb1e953d73762e5263e.zip |
Keep a priv pointer in the object struct instead of using G_TYPE_INSTANCE_GET_PRIVATE all the time.
svn path=/trunk/; revision=1082
Diffstat (limited to 'libempathy-gtk')
32 files changed, 139 insertions, 148 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 <gtk/gtk.h> #include <gio/gio.h> +#include <libempathy/empathy-utils.h> #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 <libempathy/empathy-debug.h> -#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 <gtk/gtk.h> #include <gdk/gdkx.h> +#include <libempathy/empathy-utils.h> #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 <gtk/gtktreeview.h> +#include <libempathy/empathy-utils.h> #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 <string.h> +#include <libempathy/empathy-utils.h> #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 <libempathy/empathy-debug.h> -#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 <gconf/gconf-client.h> +#include <libempathy/empathy-utils.h> #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 <telepathy-glib/util.h> +#include <libempathy/empathy-utils.h> #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 <string.h> +#include <libempathy/empathy-utils.h> #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 <glib/gi18n.h> #include <gtk/gtk.h> +#include <libempathy/empathy-utils.h> #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 <glib/gi18n.h> +#include <libempathy/empathy-utils.h> #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 { |