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 --- 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 ++-- 6 files changed, 32 insertions(+), 38 deletions(-) (limited to 'src') 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